• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <gtest/gtest.h>
2 #include <string.h>
3 
4 using namespace testing::ext;
5 
6 constexpr size_t SET_LEN = 5;
7 
8 class StringMemsetTest : public testing::Test {
SetUp()9     void SetUp() override {}
TearDown()10     void TearDown() override {}
11 };
12 
13 /**
14  * @tc.name: memset_001
15  * @tc.desc: Verify whether the memset function can correctly fill the specified character into the string without
16  *           affecting the values of other characters in the string.
17  * @tc.type: FUNC
18  */
19 HWTEST_F(StringMemsetTest, memset_001, TestSize.Level1)
20 {
21     char str[] = "hello, world";
22     memset(str, '!', SET_LEN);
23     EXPECT_STREQ(str, "!!!!!, world");
24 }