X-Git-Url: http://nsz.repo.hu/git/?p=libc-test;a=blobdiff_plain;f=src%2Ffunctional%2Fstring.c;h=682a1c77ff680db54e5e4af73338a9d78e2e9dca;hp=2e06eb90d446b0dbe840aea24e5f2a21f13c7e7f;hb=2c671f66e28ac079ae1148f5135c9a52129cc807;hpb=2cf89517c5b25c2524fe0c0c01ed277d7307a852 diff --git a/src/functional/string.c b/src/functional/string.c index 2e06eb9..682a1c7 100644 --- a/src/functional/string.c +++ b/src/functional/string.c @@ -1,4 +1,5 @@ -#define _BSD_SOURCE +#define _DEFAULT_SOURCE 1 +#define _BSD_SOURCE 1 #include #include #include "test.h" @@ -11,11 +12,11 @@ #define TEST(r, f, x, m) ( \ ((r) = (f)) == (x) || \ - (error("%s failed (" m ")\n", #f, r, x), 0) ) + (t_error("%s failed (" m ")\n", #f, r, x), 0) ) #define TEST_S(s, x, m) ( \ !strcmp((s),(x)) || \ - (error("[%s] != [%s] (%s)\n", s, x, m), 0) ) + (t_error("[%s] != [%s] (%s)\n", s, x, m), 0) ) int main(void) { @@ -78,7 +79,6 @@ int main(void) TEST(s, strtok(NULL, " ;"), b+16, "%p != %p"); TEST_S(s, "foo", "strtok result"); -#ifdef HAVE_BSD_STRL memset(b, 'x', sizeof b); TEST(i, strlcpy(b, "abc", sizeof b - 1), 3, "length %d != %d"); TEST(i, b[3], 0, "strlcpy did not null-terminate short string (%d)"); @@ -111,6 +111,6 @@ int main(void) memcpy(b, "abc\0\0\0x\0", 8); TEST(i, strlcat(b, "123", 3), 6, "length %d != %d"); TEST_S(b, "abc", "strlcat result"); -#endif - return test_status; + + return t_status; }