Commit 04f76fbb authored by Dominik Charousset's avatar Dominik Charousset

Fix shadowing warnings and use shutdown in tests

parent 19abf110
......@@ -146,6 +146,10 @@ oss_wr operator<<(oss_wr&& lhs, T rhs) {
#define CAF_LVL_NAME3() "DEBUG"
#define CAF_LVL_NAME4() "TRACE"
#define CAF_CONCAT_(LHS, RHS) LHS ## RHS
#define CAF_CONCAT(LHS, RHS) CAF_CONCAT_(LHS, RHS)
#define CAF_UNIFYN(NAME) CAF_CONCAT(NAME, __LINE__)
#define CAF_PRINT_ERROR_IMPL(lvlname, classname, funname, message) \
{ \
std::cerr << "[" << lvlname << "] " << classname << "::" << funname \
......@@ -171,15 +175,15 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; }
<< std::boolalpha \
<< message).str())
#define CAF_PUSH_AID(aid_arg) \
auto prev_aid_in_scope \
auto CAF_UNIFYN(caf_aid_tmp) \
= caf::detail::singletons::get_logger()->set_aid(aid_arg); \
auto aid_pop_sg = caf::detail::make_scope_guard([=] { \
caf::detail::singletons::get_logger()->set_aid(prev_aid_in_scope); \
auto CAF_UNIFYN(aid_aid_tmp_guard) = caf::detail::make_scope_guard([=] { \
caf::detail::singletons::get_logger()->set_aid(CAF_UNIFYN(caf_aid_tmp)); \
})
#define CAF_PUSH_AID_FROM_PTR(some_ptr) \
auto aid_ptr_argument = some_ptr; \
CAF_PUSH_AID(aid_ptr_argument ? aid_ptr_argument->id() : 0)
#define CAF_SET_AID(aid_arg) \
auto CAF_UNIFYN(caf_aid_ptr) = some_ptr; \
CAF_PUSH_AID(CAF_UNIFYN(caf_aid_ptr) ? CAF_UNIFYN(caf_aid_ptr)->id() : 0)
#define CAF_SET_AID(aid_arg) \
caf::detail::singletons::get_logger()->set_aid(aid_arg)
#endif
......@@ -204,7 +208,7 @@ inline caf::actor_id caf_set_aid_dummy() { return 0; }
#define CAF_PRINT4(arg0, arg1, arg2, arg3)
#else
#define CAF_PRINT4(lvlname, classname, funname, msg) \
caf::detail::logging::trace_helper caf_log_trace_temporary_object { \
caf::detail::logging::trace_helper CAF_UNIFYN(caf_log_trace_) { \
classname, funname, __FILE__, __LINE__, \
(caf::detail::oss_wr{} << msg).str() \
}
......
......@@ -299,7 +299,7 @@ class middleman_actor_impl : public middleman_actor_base::base {
}
template <class F>
bool finalize_request(map_type& storage, uint64_t req_id, F fun) {
bool finalize_request(map_type& storage, int64_t req_id, F fun) {
auto i = storage.find(req_id);
if (i == storage.end()) {
return false;
......
......@@ -109,5 +109,6 @@ void test_actor_lifetime() {
int main() {
CAF_TEST(test_actor_lifetime);
test_actor_lifetime();
shutdown();
return CAF_TEST_RESULT();
}
......@@ -115,5 +115,6 @@ int main() {
others >> CAF_UNEXPECTED_MSG_CB_REF(self)
);
test_typed_atom_interface();
shutdown();
return CAF_TEST_RESULT();
}
......@@ -56,5 +56,6 @@ void test_constructor_attach() {
int main() {
CAF_TEST(test_constructor_attach);
test_constructor_attach();
shutdown();
return CAF_TEST_RESULT();
}
......@@ -73,5 +73,6 @@ void test_custom_exception_handler() {
int main() {
CAF_TEST(test_custom_exception_handler);
test_custom_exception_handler();
shutdown();
return CAF_TEST_RESULT();
}
......@@ -59,5 +59,6 @@ void test_either() {
int main() {
CAF_TEST(test_either);
test_either();
shutdown();
return CAF_TEST_RESULT();
}
......@@ -104,5 +104,6 @@ void test_fixed_stack_actor() {
int main() {
CAF_TEST(test_fixed_stack_actor);
test_fixed_stack_actor();
shutdown();
return CAF_TEST_RESULT();
}
......@@ -57,5 +57,6 @@ int main() {
CAF_CHECK_EQUAL(vec7.size(), 5);
CAF_CHECK((std::all_of(vec7.begin(), vec7.end(),
[](int i) { return i == 0; })));
caf::shutdown();
return CAF_TEST_RESULT();
}
......@@ -206,5 +206,6 @@ int main() {
test_recursive_invoke_from_cache<policy::prioritizing>();
CAF_PRINT("test_recursive_invoke_from_cache<policy::not_prioritizing>");
test_recursive_invoke_from_cache<policy::not_prioritizing>();
shutdown();
return CAF_TEST_RESULT();
}
......@@ -123,5 +123,6 @@ int main() {
}
CAF_CHECK_EQUAL(class0_instances, 0);
CAF_CHECK_EQUAL(class1_instances, 0);
shutdown();
return CAF_TEST_RESULT();
}
......@@ -179,5 +179,6 @@ int main() {
test_atoms();
test_custom_projections();
test_arg_match();
shutdown();
return CAF_TEST_RESULT();
}
......@@ -116,5 +116,6 @@ int main() {
test_extract3();
test_extract_opts();
test_type_token();
shutdown();
return CAF_TEST_RESULT();
}
......@@ -75,6 +75,6 @@ int main() {
CAF_CHECK((tl_is_strict_subset<list_a, list_a>::value));
CAF_CHECK((tl_is_strict_subset<list_b, list_b>::value));
}
shutdown();
return CAF_TEST_RESULT();
}
......@@ -49,6 +49,7 @@ int main() {
CAF_CHECK(!j.empty());
}
}
shutdown();
return CAF_TEST_RESULT();
}
......@@ -53,5 +53,6 @@ void test_or_else() {
int main() {
CAF_TEST(test_or_else);
test_or_else();
shutdown();
return CAF_TEST_RESULT();
}
......@@ -13,11 +13,9 @@ std::string str_hash(const std::string& what) {
std::array<uint8_t, 20> hash;
ripemd_160(hash, what);
std::ostringstream oss;
oss << std::hex;
oss << std::setfill('0') << std::hex;
for (auto i : hash) {
oss.width(2);
oss.fill('0');
oss << static_cast<uint32_t>(i);
oss << std::setw(2) << static_cast<int>(i);
}
return oss.str();
}
......@@ -28,34 +26,22 @@ std::string str_hash(const std::string& what) {
// http://homes.esat.kuleuven.be/~bosselae/ripemd160.html
int main() {
CAF_TEST(test_ripemd_160);
CAF_CHECK_EQUAL("9c1185a5c5e9fc54612808977ee8f548b2258d31", str_hash(""));
CAF_CHECK_EQUAL("0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", str_hash("a"));
CAF_CHECK_EQUAL("8eb208f7e05d987a9b044a8e98c6b087f15a0bfc",
str_hash("abc"));
CAF_CHECK_EQUAL("8eb208f7e05d987a9b044a8e98c6b087f15a0bfc", str_hash("abc"));
CAF_CHECK_EQUAL("5d0689ef49d2fae572b881b123a85ffa21595f36",
str_hash("message digest"));
str_hash("message digest"));
CAF_CHECK_EQUAL("f71c27109c692c1b56bbdceb5b9d2865b3708dbc",
str_hash("abcdefghijklmnopqrstuvwxyz"));
str_hash("abcdefghijklmnopqrstuvwxyz"));
CAF_CHECK_EQUAL("12a053384a9c0c88e405a06c27dcf49ada62eb2b",
str_hash(
"abcdbcdecdefdefgefghfghighij"
"hijkijkljklmklmnlmnomnopnopq"));
str_hash("abcdbcdecdefdefgefghfghighij"
"hijkijkljklmklmnlmnomnopnopq"));
CAF_CHECK_EQUAL("b0e20b6e3116640286ed3a87a5713079b21f5189",
str_hash(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcde"
"fghijklmnopqrstuvwxyz0123456789"));
str_hash("ABCDEFGHIJKLMNOPQRSTUVWXYZabcde"
"fghijklmnopqrstuvwxyz0123456789"));
CAF_CHECK_EQUAL("9b752e45573d4b39f4dbd3323cab82bf63326bfb",
str_hash(
"1234567890123456789012345678901234567890"
"1234567890123456789012345678901234567890"));
str_hash("1234567890123456789012345678901234567890"
"1234567890123456789012345678901234567890"));
caf::shutdown();
return CAF_TEST_RESULT();
}
......@@ -73,5 +73,6 @@ void test_serial_reply() {
int main() {
CAF_TEST(test_serial_reply);
test_serial_reply();
shutdown();
return CAF_TEST_RESULT();
}
......@@ -307,5 +307,6 @@ int main() {
}
catch (std::exception& e) { CAF_FAILURE(to_verbose_string(e)); }
*/
shutdown();
return CAF_TEST_RESULT();
}
......@@ -27,5 +27,6 @@ void test_simple_reply_response() {
int main() {
CAF_TEST(test_simple_reply_response);
test_simple_reply_response();
shutdown();
return CAF_TEST_RESULT();
}
......@@ -406,5 +406,6 @@ int main() {
test_sync_send();
await_all_actors_done();
CAF_CHECKPOINT();
shutdown();
return CAF_TEST_RESULT();
}
......@@ -345,6 +345,6 @@ int main() {
test_sending_typed_actors_and_down_msg();
await_all_actors_done();
CAF_CHECKPOINT();
// call it a day
shutdown();
return CAF_TEST_RESULT();
}
......@@ -25,5 +25,6 @@ int main() {
CAF_CHECK_EQUAL(apply_visitor(tv, v2), "42");
v2 = 0.2f;
CAF_CHECK_EQUAL(apply_visitor(tv, v2), std::to_string(0.2f));
shutdown();
return CAF_TEST_RESULT();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment