diff options
author | Sebastian Geerken <devnull@localhost> | 2013-01-27 22:43:07 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2013-01-27 22:43:07 +0100 |
commit | 5eee444eaefbdcd3fb459c2a65376ef1fa873056 (patch) | |
tree | db622afad4226b08f56d883d8f49f2ac0567d9fe | |
parent | b81d6410ef72dee94915711bc5c777355a4dab20 (diff) |
Test for containers. (Just curious how complete the code is ...)
-rw-r--r-- | test/Makefile.am | 4 | ||||
-rw-r--r-- | test/containers.cc | 28 |
2 files changed, 32 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 9f38e918..6a834acb 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -19,6 +19,7 @@ noinst_PROGRAMS = \ dw-imgbuf-mem-test \ dw-resource-test \ dw-ui-test \ + containers \ shapes \ cookies \ liang \ @@ -155,6 +156,9 @@ shapes_LDADD = \ $(top_builddir)/dw/libDw-core.a \ $(top_builddir)/lout/liblout.a +containers_SOURCES = containers.cc +containers_LDADD = $(top_builddir)/lout/liblout.a + cookies_SOURCES = cookies.c cookies_LDADD = \ $(top_builddir)/dpip/libDpip.a \ diff --git a/test/containers.cc b/test/containers.cc new file mode 100644 index 00000000..9667564e --- /dev/null +++ b/test/containers.cc @@ -0,0 +1,28 @@ +#include "../lout/object.hh" +#include "../lout/container.hh" + +using namespace lout::object; +using namespace lout::container::typed; + +void testHashTable () +{ + HashTable<String, Integer> h(true, true); + + h.put (new String ("one"), new Integer (1)); + h.put (new String ("two"), new Integer (2)); + h.put (new String ("three"), new Integer (3)); + + Iterator<String> it = h.iterator (); + while (it.hasNext ()) { + String *k = it.getNext (); + Integer *v = h.get (k); + printf ("%s -> %d\n", k->chars(), v->getValue()); + } +} + +int main (int argc, char *argv[]) +{ + testHashTable (); + + return 0; +} |