chiark / gitweb /
use libinn logging where applicable - debugged
[inn-innduct.git] / tests / lib / memcmp-t.c
1 /* $Id: memcmp-t.c 5054 2001-12-12 09:15:24Z rra $ */
2 /* memcmp test suite. */
3
4 #include "config.h"
5 #include <stdio.h>
6 #include <sys/types.h>
7
8 #include "libtest.h"
9
10 int test_memcmp(const void *, const void *, size_t);
11
12 int
13 main(void)
14 {
15     puts("15");
16
17     ok( 1, test_memcmp("",             "",             0) == 0);
18     ok( 2, test_memcmp("",             "",             1) == 0);
19     ok( 3, test_memcmp("alpha",        "alpha",        6) == 0);
20     ok( 4, test_memcmp("alpha",        "beta",         5)  < 0);
21     ok( 5, test_memcmp("beta",         "alpha",        5)  > 0);
22     ok( 6, test_memcmp("alpha",        "apple",        1) == 0);
23     ok( 7, test_memcmp("alpha",        "apple",        2)  < 0);
24     ok( 8, test_memcmp("\0v",          "\0w",          2)  < 0);
25     ok( 9, test_memcmp("\200\201\202", "\200\201\202", 4) == 0);
26     ok(10, test_memcmp("\200\201\202", "\200\201\203", 4)  < 0);
27     ok(11, test_memcmp("\200\201\203", "\200\201\202", 4)  > 0);
28     ok(12, test_memcmp("al\0po",       "al\0pha",      6)  > 0);
29     ok(13, test_memcmp("\100",         "\201",         1)  < 0);
30     ok(14, test_memcmp("\200",         "\201",         1)  < 0);
31     ok(15, test_memcmp("a",            "b",            0) == 0);
32
33     return 0;
34 }