• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 "calculator.h"
17 #include <gtest/gtest.h>
18 
19 using namespace testing::ext;
20 
21 class CalculatorSubTest : public testing::Test {
22 public:
23     static void SetUpTestCase(void);
24     static void TearDownTestCase(void);
25     void SetUp();
26     void TearDown();
27 };
28 
SetUpTestCase(void)29 void CalculatorSubTest::SetUpTestCase(void)
30 {
31     // step 2: input testsuit setup step
32 }
33 
TearDownTestCase(void)34 void CalculatorSubTest::TearDownTestCase(void)
35 {
36     // step 2: input testsuit teardown step
37 }
38 
SetUp(void)39 void CalculatorSubTest::SetUp(void)
40 {
41     // step 3: input testcase setup step
42 }
43 
TearDown(void)44 void CalculatorSubTest::TearDown(void)
45 {
46     // step 3: input testcase teardown step
47 }
48 
49 /**
50  * @tc.name: integer_sub_001
51  * @tc.desc: Verify the sub function.
52  * @tc.type: FUNC
53  * @tc.require: AR00000000 SR00000000
54  */
55 HWTEST_F(CalculatorSubTest, integer_sub_001, TestSize.Level1)
56 {
57     EXPECT_EQ(4, Sub(4, 0));
58 }
59 
60 /**
61  * @tc.name: integer_sub_002
62  * @tc.desc: Verify the sub function.
63  * @tc.type: FUNC
64  * @tc.require: AR00000000 SR00000000
65  */
66 HWTEST_F(CalculatorSubTest, integer_sub_002, TestSize.Level3)
67 {
68     EXPECT_EQ(-2, Sub(5, 7));
69 }
70 
71