Line data Source code
1 : /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 : /* unit-test-oid.c: Test OID routines
3 : Copyright (C) 2008 Stefan Walter
4 :
5 : The Gnome Keyring Library is free software; you can redistribute it and/or
6 : modify it under the terms of the GNU Library General Public License as
7 : published by the Free Software Foundation; either version 2 of the
8 : License, or (at your option) any later version.
9 :
10 : The Gnome Keyring Library is distributed in the hope that it will be useful,
11 : but WITHOUT ANY WARRANTY; without even the implied warranty of
12 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 : Library General Public License for more details.
14 :
15 : You should have received a copy of the GNU Library General Public
16 : License along with the Gnome Library; see the file COPYING.LIB. If not,
17 : <http://www.gnu.org/licenses/>.
18 :
19 : Author: Stef Walter <stef@memberwebs.com>
20 : */
21 :
22 : #include "config.h"
23 :
24 : #include "egg/egg-oid.h"
25 :
26 : #include <glib.h>
27 :
28 : static void
29 1 : test_tests (void)
30 : {
31 : GQuark oid;
32 :
33 1 : oid = g_quark_from_static_string ("0.9.2342.19200300.100.1.25");
34 1 : g_assert_cmpstr (egg_oid_get_name (oid), ==, "DC");
35 1 : g_assert_cmpstr (egg_oid_get_description (oid), ==, "Domain Component");
36 1 : g_assert_cmpuint (egg_oid_get_flags (oid), ==, EGG_OID_PRINTABLE);
37 :
38 : /* Should return OID for invalid oids */
39 1 : oid = g_quark_from_static_string ("1.1.1.1.1");
40 1 : g_assert_cmpstr (egg_oid_get_name (oid), ==, "1.1.1.1.1");
41 1 : g_assert_cmpstr (egg_oid_get_description (oid), ==, "1.1.1.1.1");
42 1 : g_assert_cmpuint (egg_oid_get_flags (oid), ==, 0);
43 1 : }
44 :
45 : int
46 1 : main (int argc, char **argv)
47 : {
48 1 : g_test_init (&argc, &argv, NULL);
49 :
50 1 : g_test_add_func ("/oid/tests", test_tests);
51 :
52 1 : return g_test_run ();
53 : }
|