regex memory corruption regression test
[libc-test] / src / regression / strverscmp.c
1 // leading zero handling according to the manual
2 #define _GNU_SOURCE
3 #include <string.h>
4 #include "test.h"
5
6 #define ASSERT(x) ((x) || (t_error(#x " failed\n"),0))
7
8 int main()
9 {
10         ASSERT(strverscmp("", "") == 0);
11         ASSERT(strverscmp("a", "a") == 0);
12         ASSERT(strverscmp("a", "b") < 0);
13         ASSERT(strverscmp("b", "a") > 0);
14         ASSERT(strverscmp("000", "00") < 0);
15         ASSERT(strverscmp("00", "000") > 0);
16         ASSERT(strverscmp("a0", "a") > 0);
17         ASSERT(strverscmp("00", "01") < 0);
18         ASSERT(strverscmp("01", "010") < 0);
19         ASSERT(strverscmp("010", "09") < 0);
20         ASSERT(strverscmp("09", "0") < 0);
21         ASSERT(strverscmp("9", "10") < 0);
22         ASSERT(strverscmp("0a", "0") > 0);
23         ASSERT(strverscmp("foobar-1.1.2", "foobar-1.1.3") < 0);
24         ASSERT(strverscmp("foobar-1.1.2", "foobar-1.01.3") > 0);
25         return t_status;
26 }