1 #include <fcntl.h> 2 #include <gtest/gtest.h> 3 #include <sys/stat.h> 4 #define __FORTIFY_COMPILATION 5 #include <fortify/string.h> 6 7 #define MAX_SIZE 1024 8 9 using namespace testing::ext; 10 11 class FortifyStrlcatchkTest : public testing::Test { SetUp()12 void SetUp() override {} TearDown()13 void TearDown() override {} 14 }; 15 16 /** 17 * @tc.name: __strlcat_chk_001 18 * @tc.desc: Verify if the __strlcat_chk is functioning properly. 19 * @tc.type: FUNC 20 * */ 21 HWTEST_F(FortifyStrlcatchkTest, __strlcat_chk_001, TestSize.Level1) 22 { 23 char srcChar[MAX_SIZE] = "Source"; 24 const char* dstChar = "Destination"; 25 __strlcat_chk(srcChar, dstChar, MAX_SIZE, MAX_SIZE); 26 EXPECT_STREQ("SourceDestination", srcChar); 27 } 28