diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-08-30 08:23:44 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-08-30 08:44:58 -0700 |
commit | 5d856f70e9515ea5288d9cc9b15996af41bf4f7f (patch) | |
tree | a8d9dea9ab94f4162f8ff2e34ab919439a8356fc /tests/test-strverscmp.c | |
parent | a56908381dd1ed630007a04ad03db17b1795e539 (diff) | |
download | gnulib-5d856f70e9515ea5288d9cc9b15996af41bf4f7f.tar.gz |
strverscmp: sync with glibc
Although this doesn't exactly synchronize with glibc
byte-for-byte, it makes the code behave the same as glibc.
* lib/strverscmp.c (S_I, S_F, S_Z): Now masks, not powers of 2.
(ISDIGIT): Remove, as glibc is sticking with isdigit, and the
difference shouldn't matter in practical use. All uses changed
back to isdigit.
(__strverscmp, strverscmp): Use new glibc method for weak aliases.
(next_state): Now unsigned char array; redo elements.
(result_type): Now signed char array; redo elements.
(__strverscmp): Fix glibc bug 9913 by using new states.
* tests/test-strverscmp.c (main): Test glibc bug 9913.
Diffstat (limited to 'tests/test-strverscmp.c')
-rw-r--r-- | tests/test-strverscmp.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test-strverscmp.c b/tests/test-strverscmp.c index e5a6bb10f8..0cafe08fb1 100644 --- a/tests/test-strverscmp.c +++ b/tests/test-strverscmp.c @@ -41,5 +41,19 @@ main (void) ASSERT (strverscmp ("09", "0") < 0); ASSERT (strverscmp ("9", "10") < 0); ASSERT (strverscmp ("0a", "0") > 0); + + /* From glibc bug 9913. */ + { + static char const a[] = "B0075022800016.gbp.corp.com"; + static char const b[] = "B007502280067.gbp.corp.com"; + static char const c[] = "B007502357019.GBP.CORP.COM"; + ASSERT (strverscmp (a, b) < 0); + ASSERT (strverscmp (b, c) < 0); + ASSERT (strverscmp (a, c) < 0); + ASSERT (strverscmp (b, a) > 0); + ASSERT (strverscmp (c, b) > 0); + ASSERT (strverscmp (c, a) > 0); + } + return 0; } |