lilypond-1.5.6
[lilypond.git] / test / hash.cc
blobee67572b7602ac27e6f00a9809509df6a3170576
1 #include <stdio.h>
2 #include <iostream.h>
3 #include "dictionary-iter.hh"
7 main ()
9 Dictionary<String> *dict = new Dictionary<String>;
11 char s[1000];
13 dict->elem("foo") = "bar";
14 dict->elem("bla") = "ba";
15 dict->elem("blo") = "bar";
17 while (gets (s))
19 String str (s);
21 int l = str.length_i ();
23 dict->elem (str.left_str (l/2)) = str.right_str (l/2);
26 int i=1000;
27 while (i--)
29 Dictionary<String> *dict2=new Dictionary<String> (*dict);
30 delete dict;
31 dict = dict2;
34 for (Dictionary_iter<String> i (*dict); i.ok (); i++)
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;