fixed stack tests to work with 4-byte-alignment + fixed logging tests

Mon, 28 Jul 2014 15:02:17 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 28 Jul 2014 15:02:17 +0200
changeset 187
7d49f179cc25
parent 186
05559c99010d
child 188
63f87e2884c1

fixed stack tests to work with 4-byte-alignment + fixed logging tests

test/logging_tests.c file | annotate | diff | comparison | revisions
test/stack_tests.c file | annotate | diff | comparison | revisions
--- a/test/logging_tests.c	Mon Jul 28 14:44:06 2014 +0200
+++ b/test/logging_tests.c	Mon Jul 28 15:02:17 2014 +0200
@@ -75,10 +75,10 @@
 
     UcxLogger *logger = ucx_logger_new(stream,
             UCX_LOGGER_INFO, UCX_LOGGER_SOURCE | UCX_LOGGER_LEVEL);
-    logger->dateformat = (char*) "%F:";
+    logger->dateformat = (char*) "%Y-%m-%d:";
     
     UCX_TEST_BEGIN
-    const uint line1 = __LINE__; ucx_logger_info(logger, "allright");
+    const unsigned int line1 = __LINE__; ucx_logger_info(logger, "allright");
     
     ucx_logger_trace(logger, "dont log this!");
     
@@ -86,8 +86,7 @@
     time_t now = time(NULL);
     char timestr[13];
     strftime(timestr, 12, "%Y-%m-%d:", localtime(&now));
-    const unsigned int line2 = __LINE__;
-    ucx_logger_error(logger, "error %d!", 42);
+    const unsigned int line2 = __LINE__; ucx_logger_error(logger, "error %d!", 42);
     
     fseek(stream, 0, SEEK_SET);
     size_t r = fread(buffer, 1, 100, stream);
--- a/test/stack_tests.c	Mon Jul 28 14:44:06 2014 +0200
+++ b/test/stack_tests.c	Mon Jul 28 15:02:17 2014 +0200
@@ -29,9 +29,9 @@
 #include "stack_tests.h"
 
 #define test_ucx_stack_before \
-    char space[100]; \
+    char space[99]; \
     UcxStack stack; \
-    ucx_stack_init(&stack, space, 100) \
+    ucx_stack_init(&stack, space, 99) \
 
 UCX_TEST(test_ucx_stack_init) {
     
@@ -48,7 +48,7 @@
         "allocator not properly set");
     
     UCX_TEST_ASSERT(!stack.top && stack.space == space
-        && stack.size == 100 - 100 % sizeof(void*),
+        && stack.size == 99 - 99 % sizeof(void*),
         "struct fields not properly set");
     
     UCX_TEST_END
@@ -93,9 +93,9 @@
     
     test_ucx_stack_before;
 
-    char zeros[100];
-    memset(zeros, 0, 100);
-    memset(space, 32, 100);
+    char zeros[99];
+    memset(zeros, 0, 99);
+    memset(space, 32, 99);
     ucx_stack_calloc(&stack, 4, sizeof(int));
     
     UCX_TEST_BEGIN
@@ -139,7 +139,7 @@
     
     test_ucx_stack_before;
     
-    void *fst = ucx_stack_malloc(&stack, 10);
+    void *fst = ucx_stack_malloc(&stack, 14);
     void *snd = ucx_stack_malloc(&stack, 10);
     
     UCX_TEST_BEGIN
@@ -175,7 +175,7 @@
 UCX_TEST(test_ucx_stack_pop) {
     
     test_ucx_stack_before;
-    memset(space, 32, 100);
+    memset(space, 32, 99);
     
     void *fst = ucx_stack_malloc(&stack, 10);
     void *snd = ucx_stack_malloc(&stack, 10);

mercurial