summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2013-03-04 23:45:56 +0100
committerSebastian Geerken <devnull@localhost>2013-03-04 23:45:56 +0100
commit0128efee08d42bd4efa1fda3bc12664b216712ae (patch)
treeda9d566a01cd7fd2164549f6aed808cef2de6c4e
parente6a5d09b561a0c38b3fd75bb689ce62f8d3981da (diff)
Simplified containers test.
-rw-r--r--test/containers.cc24
1 files changed, 8 insertions, 16 deletions
diff --git a/test/containers.cc b/test/containers.cc
index 646624aa..661f68d6 100644
--- a/test/containers.cc
+++ b/test/containers.cc
@@ -6,42 +6,34 @@ using namespace lout::container::typed;
void testHashSet ()
{
+ puts ("--- testHashSet ---");
+
HashSet<String> h(true);
h.put (new String ("one"));
h.put (new String ("two"));
h.put (new String ("three"));
- Iterator<String> it = h.iterator ();
- while (it.hasNext ()) {
- String *o = it.getNext ();
- printf ("%s\n", o->chars());
- }
+ puts (h.toString());
}
void testHashTable ()
{
+ puts ("--- 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));
- for (Iterator<String> it = h.iterator (); it.hasNext (); ) {
- String *k = it.getNext ();
- Integer *v = h.get (k);
- printf ("%s -> %d\n", k->chars(), v->getValue());
- }
+ puts (h.toString());
h.put (new String ("one"), new Integer (4));
h.put (new String ("two"), new Integer (5));
h.put (new String ("three"), new Integer (6));
-
- for (Iterator<String> it = h.iterator (); it.hasNext (); ) {
- String *k = it.getNext ();
- Integer *v = h.get (k);
- printf ("%s -> %d\n", k->chars(), v->getValue());
- }
+
+ puts (h.toString());
}
int main (int argc, char *argv[])