1 #include <gtest/gtest.h> 2 #include <string.h> 3 4 constexpr int STR_SIZE = 13; 5 6 using namespace testing::ext; 7 8 class FortifyStrlenchkTest : public testing::Test { SetUp()9 void SetUp() override {} TearDown()10 void TearDown() override {} 11 }; 12 13 /** 14 * @tc.name: __strlen_chk_001 15 * @tc.desc: Verify if the function is functioning properly. 16 * @tc.type: FUNC 17 * */ 18 HWTEST_F(FortifyStrlenchkTest, __strlen_chk_001, TestSize.Level1) 19 { 20 char str[] = "Hello, world!"; 21 int result = __strlen_chk(str, sizeof(str)); 22 EXPECT_EQ(STR_SIZE, result); 23 }