1 /* 2 * Copyright (C) 2024 HiHope Open Source Organization. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include <cerrno> 17 #include <cstdio> 18 #include <cstdlib> 19 #include <string> 20 #include <vector> 21 #include <unistd.h> 22 #include <gtest/gtest.h> 23 #include <sys/stat.h> 24 #include <sys/types.h> 25 26 27 using namespace testing::ext; 28 using namespace std; 29 30 class GetgidApiTest : public testing::Test { 31 public: 32 static void SetUpTestCase(); 33 static void TearDownTestCase(); 34 void SetUp(); 35 void TearDown(); 36 private: 37 }; SetUp()38void GetgidApiTest::SetUp() 39 { 40 } TearDown()41void GetgidApiTest::TearDown() 42 { 43 } SetUpTestCase()44void GetgidApiTest::SetUpTestCase() 45 { 46 } TearDownTestCase()47void GetgidApiTest::TearDownTestCase() 48 { 49 } 50 51 /* 52 * @tc.number : SUB_KERNEL_SYSCALL_GETGID_0100 53 * @tc.name : GetgidTestSuccess_0001 54 * @tc.desc : Getgid get group ID success. 55 * @tc.size : MediumTest 56 * @tc.type : Function 57 * @tc.level : Level 1 58 */ HWTEST_F(GetgidApiTest, GetgidTestSuccess_0001, Function | MediumTest | Level1)59HWTEST_F(GetgidApiTest, GetgidTestSuccess_0001, Function | MediumTest | Level1) 60 { 61 gid_t gid = getgid(); 62 EXPECT_TRUE(gid >= 0); 63 } 64 65