i18n: Add Assamese translation
[vlc.git] / src / test / sort.c
blob0b9fcdae30e01ff9d37ae8c1a4319999d6938ffe
1 /*****************************************************************************
2 * sort.c: Test for sorting
3 *****************************************************************************
4 * Copyright (C) 2017 RĂ©mi Denis-Courmont
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
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 Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
21 #ifdef HAVE_CONFIG_H
22 # include "config.h"
23 #endif
25 #include <stdio.h>
26 #include <stdlib.h>
28 #include <vlc_common.h>
29 #include <vlc_strings.h>
31 static void test_smaller(const char *small, const char *big,
32 int (*cmp)(const char *, const char *))
34 int ret = cmp(small, big);
35 if (ret >= 0) {
36 fprintf(stderr, "Failure: \"%s\" %s \"%s\"\n",
37 small, ret ? ">" : "==", big);
38 exit(1);
42 static void test_equal(const char *s, int (*cmp)(const char *, const char *))
44 int ret = cmp(s, s);
45 if (ret != 0) {
46 fprintf(stderr, "Failure: \"%s\" %s \"%s\"\n",
47 s, (ret < 0) ? "<" : ">", s);
48 exit(1);
53 int main (void)
55 test_smaller("", "a", vlc_filenamecmp);
56 test_smaller("a", "b", vlc_filenamecmp);
57 test_smaller("foo1.ogg", "foo2.ogg", vlc_filenamecmp);
58 test_smaller("foo2.ogg", "foo10.ogg", vlc_filenamecmp);
59 test_smaller("foo1.ogg", "foo10.ogg", vlc_filenamecmp);
60 test_smaller("foo01.ogg", "foo1.ogg", vlc_filenamecmp);
61 test_equal("", vlc_filenamecmp);
62 test_equal("a", vlc_filenamecmp);
63 test_equal("123", vlc_filenamecmp);
64 return 0;