1 #include <gtest/gtest.h> 2 #include <libgen.h> 3 using namespace testing::ext; 4 5 class MiscDirnameTest : public testing::Test { SetUp()6 void SetUp() override {} TearDown()7 void TearDown() override {} 8 }; 9 10 /** 11 * @tc.name: dirname_001 12 * @tc.desc: Verify the functionality of the dirname() function by checking if it correctly extracts the parent 13 * directory from a given file path and returns a non-null pointer. 14 * @tc.type: FUNC 15 **/ 16 HWTEST_F(MiscDirnameTest, dirname_001, TestSize.Level1) 17 { 18 char path[] = "/proc/version"; 19 char* dir = dirname(path); 20 EXPECT_NE(nullptr, dir); 21 }