Branch data Line data Source code
1 : : /* gztime.c --- Shishi generalized time self tests.
2 : : * Copyright (C) 2002, 2003, 2007 Simon Josefsson
3 : : *
4 : : * This file is part of Shishi.
5 : : *
6 : : * Shishi 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 : : * Shishi 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 Shishi; if not, see http://www.gnu.org/licenses or write
18 : : * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
19 : : * Floor, Boston, MA 02110-1301, USA
20 : : *
21 : : */
22 : :
23 : : #include "utils.c"
24 : :
25 : : void
26 : 1 : test (Shishi * handle)
27 : : {
28 : : const char *p;
29 : : int n;
30 : :
31 : : /* shishi_authenticator_ctime_set() */
32 : 1 : p = shishi_generalize_time (handle, (time_t) 4711);
33 [ - + ]: 1 : if (debug)
34 : 0 : escapeprint (p, 15);
35 [ + - ][ + - ]: 2 : if (p && memcmp (p, "19700101011831Z", 15) == 0)
36 : 1 : success ("shishi_generalize_time() OK\n");
37 : : else
38 : 0 : fail ("shishi_generalize_time() failed\n");
39 : :
40 : : /* shishi_generalize_ctime() */
41 : 1 : n = (int) shishi_generalize_ctime (handle, p);
42 [ - + ]: 1 : if (debug)
43 : 0 : printf ("shishi_generalize_ctime () => `%d'.\n", n);
44 [ + - ]: 1 : if (n == 4711)
45 : 1 : success ("shishi_generalize_ctime() OK\n");
46 : : else
47 : 0 : fail ("shishi_generalize_ctime() failed\n");
48 : 1 : }
|