From 5d758f6938dc3c73e2c858255748f781aac17010 Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Tue, 9 Jul 2013 20:51:42 -0700 Subject: Added ternary tree implementation and a simple test program for it --- testtern.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 testtern.c (limited to 'testtern.c') diff --git a/testtern.c b/testtern.c new file mode 100644 index 0000000..6898371 --- /dev/null +++ b/testtern.c @@ -0,0 +1,21 @@ +#include "tern.h" +#include +#include + +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; +} + -- cgit v1.2.3 From 2c302a78d201d9b594774cec505d14c22e03662c Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Tue, 10 Sep 2013 23:31:08 -0700 Subject: Added copyright notice to source files and added GPL license text in COPYING --- testtern.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'testtern.c') diff --git a/testtern.c b/testtern.c index 6898371..b707f25 100644 --- a/testtern.c +++ b/testtern.c @@ -1,3 +1,8 @@ +/* + 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 #include -- cgit v1.2.3