TEST(utils_wrap_thread, simple_thread_replace) { g_dbg_level_set(10,"test"); // we create an empty thread and immediately replace it with another one wrap_thread wt; wt = wrap_thread(); // wt = std::move(wrap_thread()); }
// Fired after all test activities have ended. void TestsEnvReseter::OnTestProgramEnd(const ::testing::UnitTest& unit_test) { _UNUSED(unit_test); g_dbg_level_set(40, "Show again some debug after the tests"); auto skipped = instance().m_count_tests_skipped; if (skipped>0) { std::cout << banner_skip() << " Tests skipped: " << skipped << "." << std::endl; _warn("Skipped some tests."); } else std::cout << "(No tests were skipped, this is good)" << std::endl; std::cout << std::endl; }
TEST(utility, parse_ip_number) { g_dbg_level_set(255, "start test"); c_tunserver myserver; EXPECT_NO_THROW(myserver.add_peer_simplestring("192.168.2.62:9042-fd42:10a9:4318:509b:80ab:8042:6275:609b")); EXPECT_THROW (myserver.add_peer_simplestring(""), std::invalid_argument); EXPECT_THROW (myserver.add_peer_simplestring("kjfahskdfhsh"), std::invalid_argument); EXPECT_THROW (myserver.add_peer_simplestring("23947934u43y"), std::invalid_argument); EXPECT_THROW (myserver.add_peer_simplestring("192.168.2.62:9042fd42:10a9:4318:509b:80ab:8042:6275:609b"), std::invalid_argument); EXPECT_THROW (myserver.add_peer_simplestring("d42:10a9:4318:509b:80ab:8042:6275:609b-192.168.2.62:9042"), std::invalid_argument); EXPECT_THROW (myserver.add_peer_simplestring("192.168.2.62-fd42:10a9:4318:509b:80ab:8042:6275:609b"), std::invalid_argument); EXPECT_THROW (myserver.add_peer_simplestring("192.168.2.62-:9042-fd42:10a9:4318:509b:80ab:8042:6275:609b"), std::invalid_argument); EXPECT_THROW (myserver.add_peer_simplestring("562.486.489.426:9042-fd42:10a9:4318:509b:80ab:8042:6275:609b"), std::invalid_argument); EXPECT_THROW (myserver.add_peer_simplestring("192.168.2.62:9042-xyz1:10a9:4318:509b:80ab:8042:6275:609b"), std::invalid_argument); EXPECT_THROW (myserver.add_peer_simplestring("192.168.2.62:9042-fd42:10a9:4318:509b:80ab:8042:6275:609b 192.168.2.62:9042-fd42:10a9:4318:509b:80ab:8042:6275:609b"), std::invalid_argument); }
// Called before a test starts. void TestsEnvReseter::OnTestStart(const ::testing::TestInfo& test_info) { _UNUSED(test_info); g_dbg_level_set(100, "Be quiet during tests"); // test_info.test_case_name(), test_info.name()); }
TEST(stdplus_misc, function_enum_to_int__enumclass) { g_dbg_level_set(150, "reduce warnings spam from tests (int_to_enum etc)"); EXPECT_NO_THROW( { auto color = int_to_enum<t_color_components>(0); _UNUSED(color); } );