diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2012-11-30 09:31:38 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2012-11-30 09:31:38 +0000 |
commit | b8637f43b08b1407cde47fc0477a1100b617f71f (patch) | |
tree | 357fd0f56dcc9e9b6bb050ef7240642d1d587d7e /newlib/testsuite | |
parent | d551cb9226153a6855bde55aa8f0a7b0b8e688ab (diff) | |
download | newlib-b8637f43b08b1407cde47fc0477a1100b617f71f.zip newlib-b8637f43b08b1407cde47fc0477a1100b617f71f.tar.gz newlib-b8637f43b08b1407cde47fc0477a1100b617f71f.tar.bz2 |
* libc/machine/arm/strcmp.S (compute_return_value): Fix return value.
* testsuite/newlib.string/strcmp-1.c (main): Add new test cases.
Diffstat (limited to 'newlib/testsuite')
-rw-r--r-- | newlib/testsuite/newlib.string/strcmp-1.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/newlib/testsuite/newlib.string/strcmp-1.c b/newlib/testsuite/newlib.string/strcmp-1.c index a525899..71a17d6 100644 --- a/newlib/testsuite/newlib.string/strcmp-1.c +++ b/newlib/testsuite/newlib.string/strcmp-1.c @@ -239,6 +239,42 @@ main (void) } } } + + /* Check some corner cases. */ + src[1] = 'A'; + dest[1] = 'A'; + src[2] = 'B'; + dest[2] = 'B'; + src[3] = 'C'; + dest[3] = 'C'; + src[4] = '\0'; + dest[4] = '\0'; + + src[0] = 0xc1; + dest[0] = 0x41; + ret = strcmp (src, dest); + if (ret <= 0) + print_error ("\nFailed: expected positive, return %d\n", ret); + + src[0] = 0x01; + dest[0] = 0x82; + ret = strcmp (src, dest); + if (ret >= 0) + print_error ("\nFailed: expected negative, return %d\n", ret); + + dest[0] = src[0] = 'D'; + src[3] = 0xc1; + dest[3] = 0x41; + ret = strcmp (src, dest); + if (ret <= 0) + print_error ("\nFailed: expected positive, return %d\n", ret); + + src[3] = 0x01; + dest[3] = 0x82; + ret = strcmp (src, dest); + if (ret >= 0) + print_error ("\nFailed: expected negative, return %d\n", ret); + printf ("\n"); if (errors != 0) { |