• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <gtest/gtest.h>
2 #include <stdio.h>
3 using namespace testing::ext;
4 
5 class StdioFerrorTest : public testing::Test {
SetUp()6     void SetUp() override {}
TearDown()7     void TearDown() override {}
8 };
9 
10 /**
11  * @tc.name: ferror_001
12  * @tc.desc: Ensure that the ferror() function correctly detects any errors that occurred during file operations.
13  * @tc.type: FUNC
14  **/
15 HWTEST_F(StdioFerrorTest, ferror_001, TestSize.Level1)
16 {
17     FILE* file = fopen("/proc/version", "r");
18     ASSERT_TRUE(file);
19     EXPECT_EQ(0, ferror(file));
20     fclose(file);
21 }