diff testtern.c @ 487:c08a4efeee7f opengl

Update opengl branch from default. Fix build breakage unrelated to merge
author Mike Pavone <pavone@retrodev.com>
date Sat, 26 Oct 2013 22:38:47 -0700
parents 140af5509ce7
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testtern.c	Sat Oct 26 22:38:47 2013 -0700
@@ -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;
+}
+