]> git.ozlabs.org Git - ccan/blobdiff - ccan/mem/test/api.c
mem: add memeqzero.
[ccan] / ccan / mem / test / api.c
index d820a38ddf35bd9ed68097d681ebf02bb8de40e0..59b25947ab0a96d5c15de578608d7a244f331708 100644 (file)
@@ -18,7 +18,7 @@ int main(void)
        char tmp1[SWAPSIZE], tmp2[SWAPSIZE];
 
        /* This is how many tests you plan to run */
-       plan_tests(62);
+       plan_tests(65);
 
        ok1(memmem(haystack1, sizeof(haystack1), needle1, 2) == haystack1);
        ok1(memmem(haystack1, sizeof(haystack1), needle1, 3) == NULL);
@@ -113,6 +113,10 @@ int main(void)
        ok1(memcmp(tmp1, haystack2, sizeof(haystack2)) == 0);
        ok1(memcmp(tmp2, haystack1, sizeof(haystack1)) == 0);
 
+       ok1(memeqzero(NULL, 0));
+       ok1(memeqzero(scan2, 3));
+       ok1(!memeqzero(scan2, 4));
+
        /* This exits depending on whether all tests passed */
        return exit_status();
 }