1 #include <gtest/gtest.h> 2 #include <stdio.h> 3 using namespace testing::ext; 4 5 class StdioFilenounlockedTest : public testing::Test { SetUp()6 void SetUp() override {} TearDown()7 void TearDown() override {} 8 }; 9 10 /** 11 * @tc.name: fileno_unlocked_001 12 * @tc.desc: Ensure that the fileno_unlocked() function correctly retrieves the file descriptor associated with a file. 13 * @tc.type: FUNC 14 **/ 15 HWTEST_F(StdioFilenounlockedTest, fileno_unlocked_001, TestSize.Level1) 16 { 17 FILE* file = fopen("/proc/version", "r"); 18 ASSERT_NE(nullptr, file); 19 int fd = fileno_unlocked(file); 20 EXPECT_NE(-1, fd); 21 fclose(file); 22 }