Skip to content

Commit b60a70d

Browse files
committed
fix
1 parent b541dcb commit b60a70d

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

libraries/multi_index_lru/tests/benchmarks/lru_google_benchmarks.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ template<
107107
template<typename, typename, typename> class LRUCacheContainer
108108
>
109109
void google_benchmark() {
110+
#if __cplusplus >= 202002L
110111
using UserCache = LRUCacheContainer<
111112
User,
112113
indexed_by<
@@ -120,7 +121,7 @@ void google_benchmark() {
120121
lru_concept_assert_for_one_tag(UserCache, id_tag, int, User);
121122
lru_concept_assert_for_one_tag(UserCache, email_tag, std::string, User);
122123
lru_concept_assert_for_one_tag(UserCache, name_tag, std::string, User);
123-
124+
#endif
124125
for (auto size : CACHE_SIZES) {
125126
::benchmark::RegisterBenchmark(
126127
"GetOperations",

libraries/multi_index_lru/tests/tests/lru_basic_tests.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#include <iostream>
44
#include <string>
5+
#include <cassert>
56

67
#include "../lru_container_concept.h"
78

@@ -52,22 +53,22 @@ void test_lru_users() {
5253

5354
// find by id
5455
auto by_id = cache.template get<id_tag>().find(1);
55-
assert(by_id != cache.template get<id_tag>().end());
56-
assert(by_id->get().name == "Alice");
56+
assert((by_id != cache.template get<id_tag>().end()));
57+
assert((by_id->get().name == "Alice"));
5758

5859
// find by email
5960
auto by_email = cache.template get<email_tag>().find("[email protected]");
60-
assert(by_email != cache.template get<email_tag>().end());
61-
assert(by_email->get().id == 2);
61+
assert((by_email != cache.template get<email_tag>().end()));
62+
assert((by_email->get().id == 2));
6263

6364
//find by name
6465
auto by_name = cache.template get<name_tag>().find("Charlie");
65-
assert(by_name != cache.template get<name_tag>().end());
66-
assert(by_name->get().email == "[email protected]");
66+
assert((by_name != cache.template get<name_tag>().end()));
67+
assert((by_name->get().email == "[email protected]"));
6768

6869
//find by email
6970
auto it = cache.template find<email_tag, std::string>("[email protected]");
70-
assert(it != cache.template get<email_tag>().end());
71+
assert((it != cache.template get<email_tag>().end()));
7172

7273
//find by id
7374
cache.template find<id_tag, int>(1);
@@ -113,7 +114,7 @@ void test_lru_products() {
113114
cache.emplace(Product{"A2", "Mouse", 29.99});
114115

115116
auto laptop = cache.template find<sku_tag, std::string>("A1");
116-
assert(laptop != cache.template get<sku_tag>().end());
117+
assert((laptop != cache.template get<sku_tag>().end()));
117118

118119
// A1 was used, so A2 should be ousted
119120
cache.emplace(Product{"A3", "Keyboard", 79.99});

0 commit comments

Comments
 (0)