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 <cstdio> 17 #include <gtest/gtest.h> 18 #include <sys/stat.h> 19 #include "securec.h" 20 21 using namespace testing::ext; 22 using namespace std; 23 24 static const mode_t MASK = 022; 25 26 class UmaskApiTest : public testing::Test { 27 public: 28 static void SetUpTestCase(); 29 static void TearDownTestCase(); 30 void SetUp(); 31 void TearDown(); 32 private: 33 }; SetUp()34void UmaskApiTest::SetUp() 35 { 36 } TearDown()37void UmaskApiTest::TearDown() 38 { 39 } SetUpTestCase()40void UmaskApiTest::SetUpTestCase() 41 { 42 } TearDownTestCase()43void UmaskApiTest::TearDownTestCase() 44 { 45 } 46 47 /* 48 * @tc.number : SUB_KERNEL_SYSCALL_UMASK_0100 49 * @tc.name : UmaskSuccess_0001 50 * @tc.desc : umask success. 51 * @tc.size : MediumTest 52 * @tc.type : Function 53 * @tc.level : Level 1 54 */ HWTEST_F(UmaskApiTest, UmaskSuccess_0001, Function | MediumTest | Level1)55HWTEST_F(UmaskApiTest, UmaskSuccess_0001, Function | MediumTest | Level1) 56 { 57 mode_t newMask; 58 umask(MASK); 59 newMask = umask(MASK); 60 EXPECT_EQ(newMask, MASK); 61 }