/** * Stress test para geracao de Hmac com o algoritmo sha512 e chave de 150 bytes */ TEST_F(HmacTest, HmacSha512Stress_key150bytes) { for(int i = 0; i < 100000; i++) { hmac.init(HmacTest::key129bytes, MessageDigest::SHA512); ASSERT_STRCASEEQ("c50e6385aa695a38309e5a6910137e52d53f82b96288de04455cf5ac4fd68567" "9ca604f0405e8f4d0c24327bca3dbb9dd2ba6d14a5ca2a7234892f359c0830bc", hmac.doFinal(HmacTest::plainTexts[0]).toHex().c_str()); } }
TEST_F(UnitConversion, GetUnitName) { testReq.add_requirement(""); Unit meter_per_second_squared("m/s2"); std::string unit = "m/s2"; ASSERT_STRCASEEQ(unit.c_str(), meter_per_second_squared.getUnitName()); }
TEST_F(FileSysTest, GetWorkSpace) { ASSERT_STREQ("", crx::get_work_space().c_str()); g_mock_fs->m_readlink_val = "this is a test"; ASSERT_STRCASEEQ(g_mock_fs->m_readlink_val.c_str(), crx::get_work_space().c_str()); //the length of workspace at most 255 bytes g_mock_fs->m_readlink_val = std::string(1024, 'a'); ASSERT_TRUE(std::string(255, 'a') == crx::get_work_space()); ASSERT_EQ(255, crx::get_work_space().size()); }
TEST(SimpleTest, FirstTest) { // ASSERT_* can be replaced by EXPECT_*. // ASSERT_* yields fatal failure and EXPECT_* yields nonfatal failure. ASSERT_TRUE(true); ASSERT_FALSE(false); ASSERT_EQ(42, 42); ASSERT_NE(false, true); ASSERT_LT(1, 2); ASSERT_LE(1, 1); EXPECT_LE(1, 2); ASSERT_GT(1, 0); ASSERT_GE(1, 0); ASSERT_GE(0, 0); ASSERT_STREQ("foo", "foo"); ASSERT_STRNE("foo", "Foo"); ASSERT_STRCASEEQ("foo", "FOO"); ASSERT_STRCASENE("foo", "bar"); ASSERT_STRCASENE("", nullptr); }
TEST(IPTest, const_string_getIPString) { IPAddr test("123456007890"); ASSERT_STRCASEEQ("123456007890", test.getIPString().c_str()); }
TEST(IPTest, const_int_getIPString) { IPAddr test(123, 456, 7, 890); ASSERT_STRCASEEQ("123456007890", test.getIPString().c_str()); }