• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <gtest/gtest.h>
2 #include <sys/types.h>
3 #include <unistd.h>
4 
5 using namespace testing::ext;
6 
7 class LinuxGettidTest : public testing::Test {
SetUp()8     void SetUp() override {}
TearDown()9     void TearDown() override {}
10 };
11 
12 /**
13  * @tc.name: gettid_001
14  * @tc.desc: This test verifies whether the thread ID returned by the gettid function is greater than 0 to ensure that
15  *           it can successfully obtain a valid thread ID.
16  * @tc.type: FUNC
17  */
18 HWTEST_F(LinuxGettidTest, gettid_001, TestSize.Level1)
19 {
20     pid_t tid = gettid();
21     EXPECT_GT(tid, 0);
22 }