~ubuntu-branches/ubuntu/trusty/gcr/trusty-proposed

« back to all changes in this revision

Viewing changes to egg/tests/test-oid.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach
  • Date: 2012-05-03 10:18:39 UTC
  • Revision ID: package-import@ubuntu.com-20120503101839-wuvloldm7gmdsnij
Tags: upstream-3.4.1
ImportĀ upstreamĀ versionĀ 3.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
18
   Boston, MA 02111-1307, USA.
 
19
 
 
20
   Author: Stef Walter <stef@memberwebs.com>
 
21
*/
 
22
 
 
23
#include "config.h"
 
24
 
 
25
#include "egg/egg-oid.h"
 
26
 
 
27
#include <glib.h>
 
28
 
 
29
static void
 
30
test_tests (void)
 
31
{
 
32
        GQuark oid;
 
33
 
 
34
        oid = g_quark_from_static_string ("0.9.2342.19200300.100.1.25");
 
35
        g_assert_cmpstr (egg_oid_get_name (oid), ==, "DC");
 
36
        g_assert_cmpstr (egg_oid_get_description (oid), ==, "Domain Component");
 
37
        g_assert_cmpuint (egg_oid_get_flags (oid), ==, EGG_OID_PRINTABLE);
 
38
 
 
39
        /* Should return OID for invalid oids */
 
40
        oid = g_quark_from_static_string ("1.1.1.1.1");
 
41
        g_assert_cmpstr (egg_oid_get_name (oid), ==, "1.1.1.1.1");
 
42
        g_assert_cmpstr (egg_oid_get_description (oid), ==, "1.1.1.1.1");
 
43
        g_assert_cmpuint (egg_oid_get_flags (oid), ==, 0);
 
44
}
 
45
 
 
46
int
 
47
main (int argc, char **argv)
 
48
{
 
49
        g_test_init (&argc, &argv, NULL);
 
50
 
 
51
        g_test_add_func ("/oid/tests", test_tests);
 
52
 
 
53
        return g_test_run ();
 
54
}