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
     1.1 --- a/test/logging_tests.c	Mon Jul 28 14:44:06 2014 +0200
     1.2 +++ b/test/logging_tests.c	Mon Jul 28 15:02:17 2014 +0200
     1.3 @@ -75,10 +75,10 @@
     1.4  
     1.5      UcxLogger *logger = ucx_logger_new(stream,
     1.6              UCX_LOGGER_INFO, UCX_LOGGER_SOURCE | UCX_LOGGER_LEVEL);
     1.7 -    logger->dateformat = (char*) "%F:";
     1.8 +    logger->dateformat = (char*) "%Y-%m-%d:";
     1.9      
    1.10      UCX_TEST_BEGIN
    1.11 -    const uint line1 = __LINE__; ucx_logger_info(logger, "allright");
    1.12 +    const unsigned int line1 = __LINE__; ucx_logger_info(logger, "allright");
    1.13      
    1.14      ucx_logger_trace(logger, "dont log this!");
    1.15      
    1.16 @@ -86,8 +86,7 @@
    1.17      time_t now = time(NULL);
    1.18      char timestr[13];
    1.19      strftime(timestr, 12, "%Y-%m-%d:", localtime(&now));
    1.20 -    const unsigned int line2 = __LINE__;
    1.21 -    ucx_logger_error(logger, "error %d!", 42);
    1.22 +    const unsigned int line2 = __LINE__; ucx_logger_error(logger, "error %d!", 42);
    1.23      
    1.24      fseek(stream, 0, SEEK_SET);
    1.25      size_t r = fread(buffer, 1, 100, stream);
     2.1 --- a/test/stack_tests.c	Mon Jul 28 14:44:06 2014 +0200
     2.2 +++ b/test/stack_tests.c	Mon Jul 28 15:02:17 2014 +0200
     2.3 @@ -29,9 +29,9 @@
     2.4  #include "stack_tests.h"
     2.5  
     2.6  #define test_ucx_stack_before \
     2.7 -    char space[100]; \
     2.8 +    char space[99]; \
     2.9      UcxStack stack; \
    2.10 -    ucx_stack_init(&stack, space, 100) \
    2.11 +    ucx_stack_init(&stack, space, 99) \
    2.12  
    2.13  UCX_TEST(test_ucx_stack_init) {
    2.14      
    2.15 @@ -48,7 +48,7 @@
    2.16          "allocator not properly set");
    2.17      
    2.18      UCX_TEST_ASSERT(!stack.top && stack.space == space
    2.19 -        && stack.size == 100 - 100 % sizeof(void*),
    2.20 +        && stack.size == 99 - 99 % sizeof(void*),
    2.21          "struct fields not properly set");
    2.22      
    2.23      UCX_TEST_END
    2.24 @@ -93,9 +93,9 @@
    2.25      
    2.26      test_ucx_stack_before;
    2.27  
    2.28 -    char zeros[100];
    2.29 -    memset(zeros, 0, 100);
    2.30 -    memset(space, 32, 100);
    2.31 +    char zeros[99];
    2.32 +    memset(zeros, 0, 99);
    2.33 +    memset(space, 32, 99);
    2.34      ucx_stack_calloc(&stack, 4, sizeof(int));
    2.35      
    2.36      UCX_TEST_BEGIN
    2.37 @@ -139,7 +139,7 @@
    2.38      
    2.39      test_ucx_stack_before;
    2.40      
    2.41 -    void *fst = ucx_stack_malloc(&stack, 10);
    2.42 +    void *fst = ucx_stack_malloc(&stack, 14);
    2.43      void *snd = ucx_stack_malloc(&stack, 10);
    2.44      
    2.45      UCX_TEST_BEGIN
    2.46 @@ -175,7 +175,7 @@
    2.47  UCX_TEST(test_ucx_stack_pop) {
    2.48      
    2.49      test_ucx_stack_before;
    2.50 -    memset(space, 32, 100);
    2.51 +    memset(space, 32, 99);
    2.52      
    2.53      void *fst = ucx_stack_malloc(&stack, 10);
    2.54      void *snd = ucx_stack_malloc(&stack, 10);

mercurial