summaryrefslogtreecommitdiff
path: root/testtern.c
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2013-10-26 22:38:47 -0700
committerMike Pavone <pavone@retrodev.com>2013-10-26 22:38:47 -0700
commit7e61eaa7225bf025af42f88d0598aff8412f4144 (patch)
treebd19c2e555fc997065eba51715459185db566878 /testtern.c
parent4788b58c7290ad4a4a161d6bc69bc184acc2ef66 (diff)
parentb8dc9d69563379341f127af571b4bec1312f4ca0 (diff)
Update opengl branch from default. Fix build breakage unrelated to merge
--HG-- branch : opengl
Diffstat (limited to 'testtern.c')
-rw-r--r--testtern.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/testtern.c b/testtern.c
new file mode 100644
index 0000000..b707f25
--- /dev/null
+++ b/testtern.c
@@ -0,0 +1,26 @@
+/*
+ Copyright 2013 Michael Pavone
+ This file is part of BlastEm.
+ BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
+*/
+#include "tern.h"
+#include <stdio.h>
+#include <stddef.h>
+
+int main(int argc, char ** argv)
+{
+ tern_node * tree = tern_insert_ptr(NULL, "foo", "bar");
+ tree = tern_insert_ptr(tree, "foobar", "baz");
+ tree = tern_insert_ptr(tree, "goobar", "qux");
+ tree = tern_insert_int(tree, "foobarbaz", 42);
+ tree = tern_insert_int(tree, "goobarbaz", 21);
+ printf("foo: %s\n", (char *)tern_find_ptr(tree, "foo"));
+ printf("foobar: %s\n", (char *)tern_find_ptr(tree, "foobar"));
+ printf("goobar: %s\n", (char *)tern_find_ptr(tree, "goobar"));
+ printf("foob: %s\n", (char *)tern_find_ptr(tree, "foob"));
+ printf("foobarbaz: %d\n", (int)tern_find_int(tree, "foobarbaz", 0));
+ printf("goobarbaz: %d\n", (int)tern_find_int(tree, "goobarbaz", 0));
+ printf("foobarb: %d\n", (int)tern_find_int(tree, "foobarb", 0));
+ return 0;
+}
+