File tree 1 file changed +15
-19
lines changed
1 file changed +15
-19
lines changed Original file line number Diff line number Diff line change
1
+ /* ******************************************************************\
2
+
3
+ Module: Unit tests for the util/sharing_map
4
+
5
+ Author: DiffBlue Limited. All rights reserved.
6
+
7
+ \*******************************************************************/
8
+
1
9
#include < iostream>
2
10
3
11
#include < catch.hpp>
@@ -20,27 +28,14 @@ void fill2(smt &sm)
20
28
sm.insert (" n" , " 5" );
21
29
}
22
30
23
- class some_keyt
24
- {
25
- public:
26
- some_keyt (size_t s) : s(s)
27
- {
28
- }
29
-
30
- size_t s;
31
-
32
- bool operator ==(const some_keyt &other) const
33
- {
34
- return s==other.s ;
35
- }
36
- };
31
+ typedef size_t some_keyt;
37
32
38
- class some_key_hash
33
+ class some_key_hasht
39
34
{
40
35
public:
41
36
size_t operator ()(const some_keyt &k) const
42
37
{
43
- return k. s & 0x3 ;
38
+ return k & 0x3 ;
44
39
}
45
40
};
46
41
@@ -101,7 +96,8 @@ TEST_CASE("sharing map", "[core][util][sharing_map]")
101
96
s=sm2.at (" i" );
102
97
REQUIRE (s==" 0" );
103
98
104
- try {
99
+ try
100
+ {
105
101
sm2.at (" k" );
106
102
REQUIRE (false );
107
103
} catch (...) {}
@@ -205,9 +201,9 @@ TEST_CASE("sharing map", "[core][util][sharing_map]")
205
201
206
202
SECTION (" collision_test" )
207
203
{
208
- typedef sharing_mapt<some_keyt, std::string, some_key_hash> smt ;
204
+ typedef sharing_mapt<some_keyt, std::string, some_key_hasht> sm2t ;
209
205
210
- smt sm;
206
+ sm2t sm;
211
207
212
208
sm.insert (0 , " a" );
213
209
sm.insert (8 , " b" );
You can’t perform that action at this time.
0 commit comments