Add.
[shishi.git] / tests / gztime.c
blob8a158c1aa2d8d12dd753b8fce0227407804fb7c6
1 /* gztime.c Shishi generalized time self tests.
2 * Copyright (C) 2002, 2003 Simon Josefsson
4 * This file is part of Shishi.
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 2 of the License, or
9 * (at your option) any later version.
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.
16 * You should have received a copy of the GNU General Public License
17 * along with Shishi; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "utils.c"
24 void
25 test (Shishi * handle)
27 const char *p;
28 int n;
30 /* shishi_authenticator_ctime_set() */
31 p = shishi_generalize_time (handle, (time_t) 4711);
32 if (debug)
33 escapeprint (p, 15);
34 if (p && memcmp (p, "19700101011831Z", 15) == 0)
35 success ("shishi_generalize_time() OK\n");
36 else
37 fail ("shishi_generalize_time() failed\n");
39 /* shishi_generalize_ctime() */
40 n = (int) shishi_generalize_ctime (handle, p);
41 if (debug)
42 printf ("shishi_generalize_ctime () => `%d'.\n", n);
43 if (n == 4711)
44 success ("shishi_generalize_ctime() OK\n");
45 else
46 fail ("shishi_generalize_ctime() failed\n");