X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fstrndup.c;h=b96a86e86fd849baff544741e1ed016f2df929e6;hb=a9938cd46aee465e7476ab3aac773b925fc00ed4;hp=e25c7ed967855955b824c27443f4f31817abc44f;hpb=1cc4363093c919f79eafac209bb5c41548d3f88f;p=pdclib diff --git a/functions/string/strndup.c b/functions/string/strndup.c index e25c7ed..b96a86e 100644 --- a/functions/string/strndup.c +++ b/functions/string/strndup.c @@ -31,25 +31,28 @@ char *strndup( const char * s, size_t len ) int main( void ) { +#ifndef REGTEST + /* Missing on Windows. Maybe use conditionals? */ const char *teststr = "Hello, world"; const char *teststr2 = "\xFE\x8C\n"; char *testres, *testres2; - TESTCASE(testres = strndup(teststr, 5)); - TESTCASE(testres2 = strndup(teststr2, 1)); + TESTCASE((testres = strndup(teststr, 5)) != NULL); + TESTCASE((testres2 = strndup(teststr2, 1)) != NULL); TESTCASE(strcmp(testres, teststr) != 0); TESTCASE(strncmp(testres, teststr, 5) == 0); TESTCASE(strcmp(testres2, teststr2) != 0); TESTCASE(strncmp(testres2, teststr2, 1) == 0); free(testres); free(testres2); - TESTCASE(testres = strndup(teststr, 20)); - TESTCASE(testres2 = strndup(teststr2, 5)); + TESTCASE((testres = strndup(teststr, 20)) != NULL); + TESTCASE((testres2 = strndup(teststr2, 5)) != NULL); TESTCASE(strcmp(testres, teststr) == 0); TESTCASE(strcmp(testres2, teststr2) == 0); free(testres); free(testres2); - +#endif + return TEST_RESULTS; }