1/* Test of uN_strcmp() and uN_strcoll() functions.
2   Copyright (C) 2010 Free Software Foundation, Inc.
3
4   This program is free software: you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 3 of the License, or
7   (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   GNU General Public License for more details.
13
14   You should have received a copy of the GNU General Public License
15   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16
17/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
18
19static void
20test_strcmp (void)
21{
22  {
23    static const UNIT input1[] = { 0 };
24    static const UNIT input2[] = { 0 };
25    ASSERT (U_STRCMP (input1, input2) == 0);
26  }
27  {
28    static const UNIT input1[] = { 0 };
29    static const UNIT input2[] = { 'f', 'o', 'o', 0 };
30    ASSERT (U_STRCMP (input1, input2) < 0);
31    ASSERT (U_STRCMP (input2, input1) > 0);
32  }
33  {
34    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
35    static const UNIT input2[] = { 'f', 'o', 'o', 0 };
36    ASSERT (U_STRCMP (input1, input2) == 0);
37  }
38  {
39    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
40    static const UNIT input2[] = { 'b', 'a', 'r', 0 };
41    ASSERT (U_STRCMP (input1, input2) > 0);
42    ASSERT (U_STRCMP (input2, input1) < 0);
43  }
44  {
45    static const UNIT input1[] = { 'f', 'o', 'o', 0 };
46    static const UNIT input2[] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 };
47    ASSERT (U_STRCMP (input1, input2) < 0);
48    ASSERT (U_STRCMP (input2, input1) > 0);
49  }
50  {
51    static const UNIT input1[] = { 'o', 'o', 'm', 'p', 'h', 0 };
52    static const UNIT input2[] = { 'o', 'o', 'p', 's', 0 };
53    ASSERT (U_STRCMP (input1, input2) < 0);
54    ASSERT (U_STRCMP (input2, input1) > 0);
55  }
56}
57