1 #include <gtest/gtest.h> 2 #include <stdio.h> 3 4 using namespace testing::ext; 5 6 class StdioFeofunlockedTest : public testing::Test { SetUp()7 void SetUp() override {} TearDown()8 void TearDown() override {} 9 }; 10 11 /** 12 * @tc.name: feof_unlocked_001 13 * @tc.desc: Test the usage of feof_unlocked to check the end-of-file indicator on a file stream, ensuring that it 14 * accurately reflects whether there are more characters to be read from the file. 15 * @tc.type: FUNC 16 **/ 17 HWTEST_F(StdioFeofunlockedTest, feof_unlocked_001, TestSize.Level1) 18 { 19 FILE* file; 20 char ch; 21 file = fopen("/proc/version", "r"); 22 ASSERT_NE(nullptr, file); 23 EXPECT_TRUE(!feof_unlocked(file)); 24 ch = fgetc(file); 25 fclose(file); 26 }