From b0543bd23b3f5318160621e33f6ffa326ed35b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 19 Mar 2008 08:43:50 +0000 Subject: [PATCH] * A simple test that shows that our string compare functions inherited by NewOS are all broken. This is the actual reason for bug #724. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24457 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/system/libroot/posix/Jamfile | 1 + src/tests/system/libroot/posix/string/Jamfile | 5 ++++ .../libroot/posix/string/compare_test.cpp | 24 +++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 src/tests/system/libroot/posix/string/Jamfile create mode 100644 src/tests/system/libroot/posix/string/compare_test.cpp diff --git a/src/tests/system/libroot/posix/Jamfile b/src/tests/system/libroot/posix/Jamfile index 59e440aa11..b9725e4625 100644 --- a/src/tests/system/libroot/posix/Jamfile +++ b/src/tests/system/libroot/posix/Jamfile @@ -36,3 +36,4 @@ SEARCH on [ FGristFiles SubInclude HAIKU_TOP src tests system libroot posix bonnie ; SubInclude HAIKU_TOP src tests system libroot posix math ; SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite ; +SubInclude HAIKU_TOP src tests system libroot posix string ; diff --git a/src/tests/system/libroot/posix/string/Jamfile b/src/tests/system/libroot/posix/string/Jamfile new file mode 100644 index 0000000000..1780e58da7 --- /dev/null +++ b/src/tests/system/libroot/posix/string/Jamfile @@ -0,0 +1,5 @@ +SubDir HAIKU_TOP src tests system libroot posix string ; + +SimpleTest compare_test + : compare_test.cpp +; diff --git a/src/tests/system/libroot/posix/string/compare_test.cpp b/src/tests/system/libroot/posix/string/compare_test.cpp new file mode 100644 index 0000000000..9aee12efa0 --- /dev/null +++ b/src/tests/system/libroot/posix/string/compare_test.cpp @@ -0,0 +1,24 @@ +/* + * Copyright 2008, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT license. + */ + + +#include +#include + + +int +main(int argc, char** argv) +{ + char a[] = { -26, '\0' }; + char b[] = { '.', '\0' }; + + printf("strcmp(): %d\n", strcmp(a, b)); + printf("memcmp(): %d\n", memcmp(a, b, 1)); + printf("strncmp(): %d\n", strncmp(a, b, 1)); + printf("strcasecmp(): %d\n", strcasecmp(a, b)); + printf("strncasecmp(): %d\n", strncasecmp(a, b, 1)); + + return 0; +}