• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <fcntl.h>
2 #include <gtest/gtest.h>
3 #include <stdlib.h>
4 #include <sys/auxv.h>
5 #include <sys/uio.h>
6 #include <unistd.h>
7 
8 using namespace testing::ext;
9 
10 class UnistdDupTest : public testing::Test {
SetUp()11     void SetUp() override {}
TearDown()12     void TearDown() override {}
13 };
14 
15 /**
16  * @tc.name: dup_001
17  * @tc.desc: Can the dup function successfully copy standard file descriptors.
18  * @tc.type: FUNC
19  */
20 HWTEST_F(UnistdDupTest, dup_001, TestSize.Level1)
21 {
22     int fd = STDIN_FILENO;
23     int dupFd = dup(fd);
24     EXPECT_NE(fd, dupFd);
25 }