Skip to content

Commit a64de5f

Browse files
author
thk123
committed
Fixing lint in sharing map
Used different typedef name for alternative sharing map
1 parent 95903a6 commit a64de5f

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

unit/util/sharing_map.cpp

+15-19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*******************************************************************\
2+
3+
Module: Unit tests for the util/sharing_map
4+
5+
Author: DiffBlue Limited. All rights reserved.
6+
7+
\*******************************************************************/
8+
19
#include <iostream>
210

311
#include <catch.hpp>
@@ -20,27 +28,14 @@ void fill2(smt &sm)
2028
sm.insert("n", "5");
2129
}
2230

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;
3732

38-
class some_key_hash
33+
class some_key_hasht
3934
{
4035
public:
4136
size_t operator()(const some_keyt &k) const
4237
{
43-
return k.s & 0x3;
38+
return k & 0x3;
4439
}
4540
};
4641

@@ -101,7 +96,8 @@ TEST_CASE("sharing map", "[core][util][sharing_map]")
10196
s=sm2.at("i");
10297
REQUIRE(s=="0");
10398

104-
try {
99+
try
100+
{
105101
sm2.at("k");
106102
REQUIRE(false);
107103
} catch (...) {}
@@ -205,9 +201,9 @@ TEST_CASE("sharing map", "[core][util][sharing_map]")
205201

206202
SECTION("collision_test")
207203
{
208-
typedef sharing_mapt<some_keyt, std::string, some_key_hash> smt;
204+
typedef sharing_mapt<some_keyt, std::string, some_key_hasht> sm2t;
209205

210-
smt sm;
206+
sm2t sm;
211207

212208
sm.insert(0, "a");
213209
sm.insert(8, "b");

0 commit comments

Comments
 (0)