aboutsummaryrefslogtreecommitdiff
path: root/src/tests/ordhash.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-07-03 00:28:59 +0000
committerMike Buland <eichlan@xagasoft.com>2007-07-03 00:28:59 +0000
commitac517a2b7625e0aa0862679e961c6349f859ea3b (patch)
treee3e27a6b9bd5e2be6150088495c91fc91786ad9d /src/tests/ordhash.cpp
parentf8d4301e9fa4f3709258505941e37fab2eadadc6 (diff)
parentbd865cee5f89116c1f054cd0e5c275e97c2d0a9b (diff)
downloadlibbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.gz
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.bz2
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.xz
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.zip
The reorg is being put in trunk, I think it's ready. Now we just get to find
out how many applications won't work anymore :)
Diffstat (limited to 'src/tests/ordhash.cpp')
-rw-r--r--src/tests/ordhash.cpp48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/tests/ordhash.cpp b/src/tests/ordhash.cpp
deleted file mode 100644
index f1d96ec..0000000
--- a/src/tests/ordhash.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
1#include "ordhash.h"
2#include <string>
3
4typedef struct eldef
5{
6 eldef( int a, int b, const std::string &c ) :
7 id( a ), nSequence( b ), sName( c ) {}
8 int id;
9 int nSequence;
10 std::string sName;
11} eldef;
12
13struct seqcmp
14{
15 bool operator()( eldef **a, eldef **b )
16 {
17 return (*a)->nSequence < (*b)->nSequence;
18 }
19};
20
21struct namcmp
22{
23 bool operator()( eldef **a, eldef **b )
24 {
25 return (*a)->sName < (*b)->sName;
26 }
27};
28
29typedef OrdHash<int, eldef, seqcmp> AHash;
30//typedef OrdHash<int, eldef, namcmp> AHash;
31
32int main()
33{
34 AHash hsh;
35 hsh[1] = eldef( 0, 43, "Bob");
36 hsh[4] = eldef( 1, 443, "Abby");
37 hsh[2] = eldef( 2, 1, "Name");
38 hsh[5] = eldef( 3, 0, "Catagory");
39 hsh[32] = eldef( 4, 12, "Epilogue");
40
41 for( AHash::iterator i = hsh.begin(); i != hsh.end(); i++ )
42 {
43 eldef e = (*i).second;
44 printf("%d, %d, %s\n", e.id, e.nSequence, e.sName.c_str() );
45 }
46
47}
48