aboutsummaryrefslogtreecommitdiff
path: root/string/tester.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-12-06 07:59:42 +0000
committerUlrich Drepper <drepper@redhat.com>2001-12-06 07:59:42 +0000
commit1e06620a7b9c6c65284c52b4625eabd23b14c77c (patch)
tree6d1669a4982b2ce02d5cba2cb8c68452a281f829 /string/tester.c
parentf5e6e2ee301eaf4ba89399a30418e777c0d0f9d7 (diff)
downloadglibc-1e06620a7b9c6c65284c52b4625eabd23b14c77c.tar
glibc-1e06620a7b9c6c65284c52b4625eabd23b14c77c.tar.gz
glibc-1e06620a7b9c6c65284c52b4625eabd23b14c77c.tar.bz2
glibc-1e06620a7b9c6c65284c52b4625eabd23b14c77c.zip
Update.
* string/tester.c: Add tests for strcasecmp and strncasecmp. * Versions.def (libc): Add GCC_3.0. __deregister_frame_info_bases, _Unwind_Find_FDE): Add for GCC_3.0.
Diffstat (limited to 'string/tester.c')
-rw-r--r--string/tester.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/string/tester.c b/string/tester.c
index 39ae0d837e..eb630a1ff3 100644
--- a/string/tester.c
+++ b/string/tester.c
@@ -1302,6 +1302,52 @@ test_strerror (void)
check(strerror(ENOENT) != 0, 3);
}
+static void
+test_strcasecmp (void)
+{
+ it = "strcasecmp";
+ /* Note that the locale is "C". */
+ check(strcasecmp("a", "a") == 0, 1);
+ check(strcasecmp("a", "A") == 0, 2);
+ check(strcasecmp("A", "a") == 0, 3);
+ check(strcasecmp("a", "b") < 0, 4);
+ check(strcasecmp("c", "b") > 0, 5);
+ check(strcasecmp("abc", "AbC") == 0, 6);
+ check(strcasecmp("0123456789", "0123456789") == 0, 7);
+ check(strcasecmp("", "0123456789") < 0, 8);
+ check(strcasecmp("AbC", "") > 0, 9);
+ check(strcasecmp("AbC", "A") > 0, 10);
+ check(strcasecmp("AbC", "Ab") > 0, 11);
+ check(strcasecmp("AbC", "ab") > 0, 12);
+}
+
+static void
+test_strncasecmp (void)
+{
+ it = "strncasecmp";
+ /* Note that the locale is "C". */
+ check(strncasecmp("a", "a", 5) == 0, 1);
+ check(strncasecmp("a", "A", 5) == 0, 2);
+ check(strncasecmp("A", "a", 5) == 0, 3);
+ check(strncasecmp("a", "b", 5) < 0, 4);
+ check(strncasecmp("c", "b", 5) > 0, 5);
+ check(strncasecmp("abc", "AbC", 5) == 0, 6);
+ check(strncasecmp("0123456789", "0123456789", 10) == 0, 7);
+ check(strncasecmp("", "0123456789", 10) < 0, 8);
+ check(strncasecmp("AbC", "", 5) > 0, 9);
+ check(strncasecmp("AbC", "A", 5) > 0, 10);
+ check(strncasecmp("AbC", "Ab", 5) > 0, 11);
+ check(strncasecmp("AbC", "ab", 5) > 0, 12);
+ check(strncasecmp("0123456789", "AbC", 0) == 0, 13);
+ check(strncasecmp("AbC", "abc", 1) == 0, 14);
+ check(strncasecmp("AbC", "abc", 2) == 0, 15);
+ check(strncasecmp("AbC", "abc", 3) == 0, 16);
+ check(strncasecmp("AbC", "abcd", 3) == 0, 17);
+ check(strncasecmp("AbC", "abcd", 4) < 0, 18);
+ check(strncasecmp("ADC", "abcd", 1) == 0, 19);
+ check(strncasecmp("ADC", "abcd", 2) > 0, 20);
+}
+
int
main (void)
{
@@ -1412,6 +1458,11 @@ main (void)
/* strerror - VERY system-dependent. */
test_strerror ();
+ /* strcasecmp. Without locale dependencies. */
+ test_strcasecmp ();
+
+ /* strncasecmp. Without locale dependencies. */
+ test_strncasecmp ();
if (errors == 0)
{