1 #include <gtest/gtest.h> 2 #include <stdio.h> 3 #include <stdio_ext.h> 4 5 using namespace testing::ext; 6 7 class StdioFsetlockingTest : public testing::Test { SetUp()8 void SetUp() override {} TearDown()9 void TearDown() override {} 10 }; 11 #define _FSETLOCKING_INTERNAL 0 12 13 /** 14 * @tc.name: __fsetlocking_001 15 * @tc.desc: Verify that the __fsetlocking() function can successfully set the locking mode of a file stream to 16 * internal, and it checks if the function returns the expected success value of 0. 17 * @tc.type: FUNC 18 */ 19 HWTEST_F(StdioFsetlockingTest, __fsetlocking_001, TestSize.Level1) 20 { 21 FILE* file = fopen("/proc/version", "r"); 22 ASSERT_TRUE(file); 23 int result = __fsetlocking(file, _FSETLOCKING_INTERNAL); 24 EXPECT_EQ(0, result); 25 fclose(file); 26 }