Test fixes = something still not kosher local_cpptest
authorKrista Bennett <krista@pep-project.org>
Mon, 07 May 2018 17:42:40 +0200
branchlocal_cpptest
changeset 26556ace263181b8
parent 2654 be057a8a002e
child 2660 485b9eaf1b5d
Test fixes = something still not kosher
test/src/engine_tests/StringlistTests.cc
     1.1 --- a/test/src/engine_tests/StringlistTests.cc	Mon May 07 16:47:22 2018 +0200
     1.2 +++ b/test/src/engine_tests/StringlistTests.cc	Mon May 07 17:42:40 2018 +0200
     1.3 @@ -6,7 +6,6 @@
     1.4  #include "platform.h"
     1.5  #include <iostream>
     1.6  #include <fstream>
     1.7 -#include <assert.h>
     1.8  
     1.9  #include "stringlist.h"
    1.10  
    1.11 @@ -29,10 +28,10 @@
    1.12      cout << "creating one-element stringlist…\n";
    1.13      
    1.14      stringlist_t* src = new_stringlist(str0);
    1.15 -    assert(src);
    1.16 -    assert(strcmp(src->value,str0) == 0);
    1.17 +    TEST_ASSERT(src);
    1.18 +    TEST_ASSERT(strcmp(src->value,str0) == 0);
    1.19      cout << "Value: " << src->value;
    1.20 -    assert(src->next == NULL);
    1.21 +    TEST_ASSERT(src->next == NULL);
    1.22      cout << "one-element stringlist created, next element is NULL\n";
    1.23      
    1.24      cout << "freeing stringlist…\n\n";
    1.25 @@ -48,41 +47,41 @@
    1.26      const char* strarr[4] = {str1, str2, str3, str4};
    1.27      cout << "stringlist_add on empty list…\n";
    1.28      src = stringlist_add(src, str1); // src is NULL
    1.29 -    assert(src);
    1.30 -    assert(stringlist_add(src, str2)); // returns ptr to new elt
    1.31 -    assert(stringlist_add(src, str3));
    1.32 -    assert(stringlist_add(src, str4));
    1.33 +    TEST_ASSERT(src);
    1.34 +    TEST_ASSERT(stringlist_add(src, str2)); // returns ptr to new elt
    1.35 +    TEST_ASSERT(stringlist_add(src, str3));
    1.36 +    TEST_ASSERT(stringlist_add(src, str4));
    1.37      
    1.38      cout << "checking contents\n";
    1.39      stringlist_t* p = src;
    1.40      int i = 0;
    1.41      while (p) {
    1.42 -        assert(p->value);
    1.43 -        assert(strcmp(p->value, strarr[i++]) == 0);
    1.44 -        assert(p->value != *(strarr + i)); // ensure this is a copy
    1.45 -        cout << p->value;
    1.46 +        TEST_ASSERT(p->value);
    1.47 +        TEST_ASSERT(strcmp(p->value, strarr[i]) == 0);
    1.48 +        TEST_ASSERT(p->value != strarr[i]); // ensure this is a copy
    1.49          p = p->next;
    1.50 +        i++;
    1.51      }
    1.52 -    assert(p == NULL); // list ends properly
    1.53 +    TEST_ASSERT(p == NULL); // list ends properly
    1.54      
    1.55      cout << "\nduplicating four-element stringlist…\n";
    1.56      stringlist_t* dst = stringlist_dup(src);
    1.57 -    assert(dst);
    1.58 +    TEST_ASSERT(dst);
    1.59      
    1.60      stringlist_t* p_dst = dst;
    1.61      p = src;
    1.62  
    1.63      cout << "checking contents\n";    
    1.64      while (p_dst) {
    1.65 -        assert(p_dst->value);
    1.66 -        assert(strcmp(p->value, p_dst->value) == 0);
    1.67 -        assert(p->value != p_dst->value); // ensure this is a copy
    1.68 +        TEST_ASSERT(p_dst->value);
    1.69 +        TEST_ASSERT(strcmp(p->value, p_dst->value) == 0);
    1.70 +        TEST_ASSERT(p->value != p_dst->value); // ensure this is a copy
    1.71          cout << p_dst->value;
    1.72          p = p->next;
    1.73          p_dst = p_dst->next;
    1.74 -        assert((p == NULL) == (p_dst == NULL));
    1.75 +        TEST_ASSERT((p == NULL) == (p_dst == NULL));
    1.76      }
    1.77 -    assert(p_dst == NULL);
    1.78 +    TEST_ASSERT(p_dst == NULL);
    1.79          
    1.80      cout << "freeing stringlists…\n\n";
    1.81      free_stringlist(src);
    1.82 @@ -92,11 +91,11 @@
    1.83  
    1.84      cout << "duplicating one-element stringlist…\n";    
    1.85      src = new_stringlist(str0);
    1.86 -    assert(src);
    1.87 +    TEST_ASSERT(src);
    1.88      dst = stringlist_dup(src);
    1.89 -    assert(strcmp(dst->value, str0) == 0);
    1.90 +    TEST_ASSERT(strcmp(dst->value, str0) == 0);
    1.91      cout << "Value: " << src->value;
    1.92 -    assert(dst->next == NULL);
    1.93 +    TEST_ASSERT(dst->next == NULL);
    1.94      cout << "one-element stringlist duped, next element is NULL\n";
    1.95      
    1.96      cout << "\nAdd to empty stringlist (node exists, but no value…)\n";
    1.97 @@ -104,9 +103,9 @@
    1.98          free(src->value);
    1.99      src->value = NULL;
   1.100      stringlist_add(src, str2);
   1.101 -    assert(src->value);
   1.102 -    assert(strcmp(src->value, str2) == 0);
   1.103 -    assert(src->value != str2); // ensure this is a copy
   1.104 +    TEST_ASSERT(src->value);
   1.105 +    TEST_ASSERT(strcmp(src->value, str2) == 0);
   1.106 +    TEST_ASSERT(src->value != str2); // ensure this is a copy
   1.107      cout << src->value;
   1.108  
   1.109      cout << "\nfreeing stringlists…\n\n";