Add.
[shishi.git] / tests / ccache.c
blob4d44a3cb3f66c3831eece4af620959e0ab278915
1 /* ccache.c --- Self test MIT ccache file readers.
2 * Copyright (C) 2002, 2003, 2006 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 #define EXPECT 2
26 void
27 test (Shishi * handle)
29 Shishi_tkts *tkts;
30 char *ccache = getenv ("CCACHE1");
31 int rc;
33 if (!ccache)
34 ccache = "ccache1.bin";
36 rc = shishi_tkts_from_ccache_file (handle, ccache, &tkts);
37 if (rc != SHISHI_OK)
38 fail ("shishi_tkts_from_ccache_file() failed (%d)\n", rc);
40 if (shishi_tkts_size (tkts) != EXPECT)
41 fail ("shishi_tkts_size() failed (%d!=%d)\n",
42 shishi_tkts_size (tkts), EXPECT);
44 rc = shishi_tkts_write (tkts, stdout);
45 if (rc != SHISHI_OK)
46 fail ("shishi_tkts_write() failed (%d)\n", rc);
48 rc = shishi_tkts_print (tkts, stdout);
49 if (rc != SHISHI_OK)
50 fail ("shishi_tkts_print() failed (%d)\n", rc);
52 shishi_tkts_done (&tkts);