diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-04-03 03:49:53 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-04-03 03:49:53 +0000 |
commit | f4c20290509d7ed3a8fd5304577e7a4cc0b9d974 (patch) | |
tree | 13cdf64f7cf134f397a7165b7a3fe0807e37026b /src/tests/ordhash.cpp | |
parent | 74d4c8cd27334fc7204d5a8773deb3d424565778 (diff) | |
download | libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.gz libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.bz2 libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.xz libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.zip |
Ok, no code is left in src, it's all in src/old. We'll gradually move code back
into src as it's fixed and re-org'd. This includes tests, which, I may write a
unit test system into libbu++ just to make my life easier.
Diffstat (limited to 'src/tests/ordhash.cpp')
-rw-r--r-- | src/tests/ordhash.cpp | 48 |
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 | |||
4 | typedef 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 | |||
13 | struct seqcmp | ||
14 | { | ||
15 | bool operator()( eldef **a, eldef **b ) | ||
16 | { | ||
17 | return (*a)->nSequence < (*b)->nSequence; | ||
18 | } | ||
19 | }; | ||
20 | |||
21 | struct namcmp | ||
22 | { | ||
23 | bool operator()( eldef **a, eldef **b ) | ||
24 | { | ||
25 | return (*a)->sName < (*b)->sName; | ||
26 | } | ||
27 | }; | ||
28 | |||
29 | typedef OrdHash<int, eldef, seqcmp> AHash; | ||
30 | //typedef OrdHash<int, eldef, namcmp> AHash; | ||
31 | |||
32 | int 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 | |||