db8c3ba923df0d5f7bf6578effd30afcd0068587
[platform/upstream/diffutils.git] / gnulib-tests / test-mbscasecmp.c
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Test of case-insensitive string comparison function.
4    Copyright (C) 2007-2011 Free Software Foundation, Inc.
5
6    This program is free software: you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18
19 /* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
20
21 #include <config.h>
22
23 #include <string.h>
24
25 #include <locale.h>
26
27 #include "macros.h"
28
29 int
30 main ()
31 {
32   /* configure should already have checked that the locale is supported.  */
33   if (setlocale (LC_ALL, "") == NULL)
34     return 1;
35
36   ASSERT (mbscasecmp ("paragraph", "Paragraph") == 0);
37
38   ASSERT (mbscasecmp ("paragrapH", "parAgRaph") == 0);
39
40   ASSERT (mbscasecmp ("paragraph", "paraLyzed") < 0);
41   ASSERT (mbscasecmp ("paraLyzed", "paragraph") > 0);
42
43   ASSERT (mbscasecmp ("para", "paragraph") < 0);
44   ASSERT (mbscasecmp ("paragraph", "para") > 0);
45
46   /* The following tests shows how mbscasecmp() is different from
47      strcasecmp().  */
48
49   ASSERT (mbscasecmp ("\303\266zg\303\274r", "\303\226ZG\303\234R") == 0); /* özgür */
50   ASSERT (mbscasecmp ("\303\226ZG\303\234R", "\303\266zg\303\274r") == 0); /* özgür */
51
52   /* This test shows how strings of different size can compare equal.  */
53   ASSERT (mbscasecmp ("turkish", "TURK\304\260SH") == 0);
54   ASSERT (mbscasecmp ("TURK\304\260SH", "turkish") == 0);
55
56   return 0;
57 }