1 #include <fcntl.h> 2 #include <gtest/gtest.h> 3 #include <stdlib.h> 4 #include <sys/auxv.h> 5 #include <sys/uio.h> 6 #include <unistd.h> 7 8 using namespace testing::ext; 9 10 class UnistdAccessTest : public testing::Test { SetUp()11 void SetUp() override {} TearDown()12 void TearDown() override {} 13 }; 14 15 /** 16 * @tc.name: access_001 17 * @tc.desc: Ensure that the basic operations of the file can function properly. 18 * @tc.type: FUNC 19 * */ 20 HWTEST_F(UnistdAccessTest, access_001, TestSize.Level1) 21 { 22 const char* ptr = "accesstest.txt"; 23 FILE* fptr = fopen(ptr, "w"); 24 EXPECT_TRUE(fptr); 25 EXPECT_EQ(0, access(ptr, F_OK)); 26 fclose(fptr); 27 remove(ptr); 28 fptr = nullptr; 29 ptr = nullptr; 30 }