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