functional: add mntent test
[libc-test.git] / src / regression / strverscmp.c
bloba4daa26a6f4865c722c5d550b21fb7e3afbb3be0
1 // leading zero handling according to the manual
2 #define _GNU_SOURCE
3 #include <string.h>
4 #include "test.h"
6 #define ASSERT(x) ((x) || (t_error(#x " failed\n"),0))
8 int main()
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;