diff options
Diffstat (limited to 'src/tests/hash.cpp')
-rw-r--r-- | src/tests/hash.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tests/hash.cpp b/src/tests/hash.cpp new file mode 100644 index 0000000..73cfb27 --- /dev/null +++ b/src/tests/hash.cpp | |||
@@ -0,0 +1,24 @@ | |||
1 | #include "bu/hash.h" | ||
2 | #include "bu/sptr.h" | ||
3 | |||
4 | typedef struct Bob | ||
5 | { | ||
6 | int nID; | ||
7 | } Bob; | ||
8 | |||
9 | int main() | ||
10 | { | ||
11 | Bu::Hash<int, Bu::SPtr<const Bob> > lb; | ||
12 | for( int j = 0; j < 10; j++ ) | ||
13 | { | ||
14 | Bob *b = new Bob; | ||
15 | b->nID = j; | ||
16 | lb.insert( j, b ); | ||
17 | } | ||
18 | |||
19 | for( int j = 0; j < 10; j++ ) | ||
20 | { | ||
21 | printf("%d\n", lb[j].value()->nID ); | ||
22 | } | ||
23 | } | ||
24 | |||