aboutsummaryrefslogtreecommitdiff
path: root/test/containers.cc
blob: 059125ac9774535066007d8d95c4d0e09c3bdbad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "../lout/object.hh"
#include "../lout/container.hh"

using namespace lout::object;
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"));
   
   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));
   
   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));

   puts (h.toString());
}

void testVector ()
{
   puts ("--- testVector ---");

   Vector<String> v (true, 1);

   v.put (new String ("one"));
   v.put (new String ("two"));
   v.put (new String ("three"));

   puts (v.toString());
}

int main (int argc, char *argv[])
{
   testHashSet ();
   testHashTable ();
   testVector ();

   return 0;
}