]> git.donarmstrong.com Git - lilypond.git/blob - test/hash.cc
release: 1.0.17
[lilypond.git] / test / hash.cc
1 #include <stdio.h>
2 #include <iostream.h>
3 #include "dictionary-iter.hh"
4
5
6
7 main ()
8 {
9   Dictionary<String> *dict = new Dictionary<String>;
10   
11   char s[1000];
12
13   dict->elem("foo") = "bar";
14   dict->elem("bla") = "ba";
15   dict->elem("blo") = "bar";
16   
17   while (gets (s))
18     {
19       String str (s);
20
21       int l = str.length_i ();
22
23       dict->elem (str.left_str (l/2)) = str.right_str (l/2);
24     }
25
26   int i=1000;
27   while (i--)
28     {
29       Dictionary<String> *dict2=new Dictionary<String> (*dict);
30       delete dict;
31       dict = dict2;
32     }
33
34   for (Dictionary_iter<String> i (*dict); i.ok (); i++)
35     {
36       cout << i.key () << " == " << i.val () << endl;
37       cout << "elem_b: " << dict->elem_b (i.key ()) << ", key " << i.key () << " val " << dict->elem (i.key ()) <<endl;
38     }
39 }