chiark / gitweb /
debian: Prepare stuff for new version.
[mLib] / versioncmp-test.c
1 /* -*-c-*-
2  *
3  * Test rig for versioncmp
4  *
5  * (c) 2008 Straylight/Edgeware
6  */
7
8 /*----- Licensing notice --------------------------------------------------*
9  *
10  * This file is part of the mLib utilities library.
11  *
12  * mLib is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU Library General Public License as
14  * published by the Free Software Foundation; either version 2 of the
15  * License, or (at your option) any later version.
16  *
17  * mLib is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU Library General Public License for more details.
21  *
22  * You should have received a copy of the GNU Library General Public
23  * License along with mLib; if not, write to the Free
24  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
25  * MA 02111-1307, USA.
26  */
27
28 #include "testrig.h"
29 #include "versioncmp.h"
30
31 static int t_vcmp(dstr *v)
32 {
33   int ok = 1;
34   int rc = versioncmp(v[0].buf, v[1].buf);
35   if (rc != *(int *)v[2].buf) {
36     fprintf(stderr, "\nversioncmp(%s, %s) returns %d != %d\n",
37             v[0].buf, v[1].buf, rc, *(int *)v[2].buf);
38     ok = 0;
39   }
40   return (ok);
41 }
42
43 static const test_chunk tests[] = {
44   { "versioncmp", t_vcmp, { &type_string, &type_string, &type_int } },
45   { 0 }
46 };
47
48 int main(int argc, char *argv[])
49   { test_run(argc, argv, tests, SRCDIR "/versioncmp.in"); return (1); }
50
51 /*----- That's all, folks -------------------------------------------------*/