• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <errno.h>
2 #include <gtest/gtest.h>
3 #include <utmp.h>
4 
5 using namespace testing::ext;
6 
7 class LegacyUtmpnameTest : public testing::Test {
SetUp()8     void SetUp() override {}
TearDown()9     void TearDown() override {}
10 };
11 
12 /**
13  * @tc.name: utmpname_001
14  * @tc.desc: Check whether the utmpname function behaves as expected when provided with an empty string as
15  *           an argument and correctly sets errno in case of failure.
16  * @tc.type: FUNC
17  **/
18 HWTEST_F(LegacyUtmpnameTest, utmpname_001, TestSize.Level1)
19 {
20     errno = 0;
21     EXPECT_EQ(-1, utmpname(" "));
22     EXPECT_EQ(ENOTSUP, errno);
23 }