summaryrefslogtreecommitdiff
path: root/egg/test-oid.c
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2014-03-04 16:12:16 +0100
committerStef Walter <stefw@gnome.org>2014-03-05 13:02:15 +0100
commit50e0feec5d80263ba2c65d005290a3e9837905f4 (patch)
treeb014be9d7a182affbd4440a5c7ac59fb79f0bbde /egg/test-oid.c
parentbeea17679b71bdcb5363bc5844f1ed826d4424be (diff)
Makefile.am: Move tests into same directories as tested code
This allows for a cleaner build tree, and will provide benefits when moving to a single Makefile.
Diffstat (limited to 'egg/test-oid.c')
-rw-r--r--egg/test-oid.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/egg/test-oid.c b/egg/test-oid.c
new file mode 100644
index 00000000..2c013457
--- /dev/null
+++ b/egg/test-oid.c
@@ -0,0 +1,53 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* unit-test-oid.c: Test OID routines
+ Copyright (C) 2008 Stefan Walter
+
+ The Gnome Keyring Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The Gnome Keyring Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the Gnome Library; see the file COPYING.LIB. If not,
+ <http://www.gnu.org/licenses/>.
+
+ Author: Stef Walter <stef@memberwebs.com>
+*/
+
+#include "config.h"
+
+#include "egg/egg-oid.h"
+
+#include <glib.h>
+
+static void
+test_tests (void)
+{
+ GQuark oid;
+
+ oid = g_quark_from_static_string ("0.9.2342.19200300.100.1.25");
+ g_assert_cmpstr (egg_oid_get_name (oid), ==, "DC");
+ g_assert_cmpstr (egg_oid_get_description (oid), ==, "Domain Component");
+ g_assert_cmpuint (egg_oid_get_flags (oid), ==, EGG_OID_PRINTABLE);
+
+ /* Should return OID for invalid oids */
+ oid = g_quark_from_static_string ("1.1.1.1.1");
+ g_assert_cmpstr (egg_oid_get_name (oid), ==, "1.1.1.1.1");
+ g_assert_cmpstr (egg_oid_get_description (oid), ==, "1.1.1.1.1");
+ g_assert_cmpuint (egg_oid_get_flags (oid), ==, 0);
+}
+
+int
+main (int argc, char **argv)
+{
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/oid/tests", test_tests);
+
+ return g_test_run ();
+}