1 #include <gtest/gtest.h> 2 #include <utmp.h> 3 4 using namespace testing::ext; 5 6 class LegacyGetutentTest : public testing::Test { SetUp()7 void SetUp() override {} TearDown()8 void TearDown() override {} 9 }; 10 11 /** 12 * @tc.name: getutent_001 13 * @tc.desc: Verify whether the behavior of old Unix/Linux library functions such as getutent, setutent, endutent, and 14 * pututline under specific conditions meets expectations. 15 * @tc.type: FUNC 16 * */ 17 HWTEST_F(LegacyGetutentTest, getutent_001, TestSize.Level1) 18 { 19 EXPECT_EQ(-1, utmpname("test")); 20 setutent(); 21 EXPECT_EQ(nullptr, getutent()); 22 }