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 "hctest.h"
17 #include "hi_watchdog.h"
18 
19 #include "hks_api.h"
20 #include "hks_param.h"
21 #include "securec.h"
22 
23 /*
24  * @tc.register: register a test suit named "CalcMultiTest"
25  * @param: test subsystem name
26  * @param: c_example module name
27  * @param: CalcMultiTest test suit name
28  */
29 LITE_TEST_SUIT(husk, huks_lite, HksAesTest);
30 
31 /**
32  * @tc.setup: define a setup for test suit, format:"CalcMultiTest + SetUp"
33  * @return: true——setup success
34  */
HksAesTestSetUp()35 static BOOL HksAesTestSetUp()
36 {
37     LiteTestPrint("setup\n");
38     hi_watchdog_disable();
39     TEST_ASSERT_TRUE(HksInitialize() == 0);
40     return TRUE;
41 }
42 
43 /**
44  * @tc.teardown: define a setup for test suit, format:"CalcMultiTest + TearDown"
45  * @return: true——teardown success
46  */
HksAesTestTearDown()47 static BOOL HksAesTestTearDown()
48 {
49     LiteTestPrint("tearDown\n");
50     hi_watchdog_enable();
51     return TRUE;
52 }
53 
54 #ifndef _CUT_AUTHENTICATE_
55 #ifndef _CUT_ED25519_
56 /**
57  * @tc.name: HksCipherTest.HksCipherTest001
58  * @tc.desc: The static function will return true;
59  * @tc.type: FUNC
60  */
LITE_TEST_CASE(HksAesTest,HksAesTest001,Level1)61 LITE_TEST_CASE(HksAesTest, HksAesTest001, Level1)
62 {
63     TEST_ASSERT_TRUE(TestAes256ByAgree() == 0);
64 }
65 
66 /**
67  * @tc.name: HksCipherTest.HksCipherTest002
68  * @tc.desc: The static function will return true;
69  * @tc.type: FUNC
70  */
LITE_TEST_CASE(HksAesTest,HksAesTest002,Level1)71 LITE_TEST_CASE(HksAesTest, HksAesTest002, Level1)
72 {
73     TEST_ASSERT_TRUE(TestAes256ByAgree1() == 0);
74 }
75 
76 /**
77  * @tc.name: HksCipherTest.HksCipherTest003
78  * @tc.desc: The static function will return true;
79  * @tc.type: FUNC
80  */
LITE_TEST_CASE(HksAesTest,HksAesTest003,Level1)81 LITE_TEST_CASE(HksAesTest, HksAesTest003, Level1)
82 {
83     TEST_ASSERT_TRUE(TestAes256ByAgree2() == 0);
84 }
85 #endif
86 #endif /* _CUT_AUTHENTICATE_ */
87 
88 /**
89  * @tc.name: HksCipherTest.HksCipherTest004
90  * @tc.desc: The static function will return true;
91  * @tc.type: FUNC
92  */
LITE_TEST_CASE(HksAesTest,HksAesTest004,Level1)93 LITE_TEST_CASE(HksAesTest, HksAesTest004, Level1)
94 {
95     TEST_ASSERT_EQUAL(TestAes256ByLocal(), 0);
96 }
97 
98 RUN_TEST_SUITE(HksAesTest);
99