diff options
Diffstat (limited to 'test')
-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; +} |