• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 Huawei Device Co., Ltd.
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 <climits>
17 #include <gtest/gtest.h>
18 
19 using namespace std;
20 using namespace testing::ext;
21 
22 class CalcSubtractionTest : public testing::Test {
23 public:
24     static void SetUpTestCase(void);
25     static void TearDownTestCase(void);
26     void SetUp();
27     void TearDown();
28 };
29 
SetUpTestCase(void)30 void CalcSubtractionTest::SetUpTestCase(void)
31 {
32     // step 2: input testsuit setup step
33 }
34 
TearDownTestCase(void)35 void CalcSubtractionTest::TearDownTestCase(void)
36 {
37     // step 2: input testsuit teardown step
38 }
39 
SetUp(void)40 void CalcSubtractionTest::SetUp(void)
41 {
42     // step 3: input testcase setup step
43 }
44 
TearDown(void)45 void CalcSubtractionTest::TearDown(void)
46 {
47     // step 3: input testcase teardown step
48 }
49 
Subtraction(int a,int b)50 static int Subtraction(int a, int b)
51 {
52     return a - b;
53 }
54 
55 /*
56  * Feature: Calculator
57  * Function: Subtraction
58  * SubFunction: NA
59  * FunctionPoints: Integer Subtraction
60  * EnvConditions: NA
61  * CaseDescription: Verify the Subtraction function.
62  */
63 HWTEST_F(CalcSubtractionTest, integer_sub_001, TestSize.Level1)
64 {
65     EXPECT_EQ(0, Subtraction(1, 0));
66 }
67 
68 /*
69  * Feature: Calculator
70  * Function: Subtraction
71  * SubFunction: NA
72  * FunctionPoints: Integer Subtraction
73  * EnvConditions: NA
74  * CaseDescription: Verify the Subtraction function.
75  */
76 HWTEST_F(CalcSubtractionTest, integer_sub_002, TestSize.Level1)
77 {
78     EXPECT_EQ(1, Subtraction(2, 1));
79 }