1 /*
2 * Copyright (C) 2024 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 "openssl_common.h"
17
18 #include <gtest/gtest.h>
19
20 using namespace std;
21 using namespace testing::ext;
22
23 namespace {
24 class CryptoOsslCommonTest : public testing::Test {
25 public:
26 static void SetUpTestCase();
27 static void TearDownTestCase();
28 void SetUp();
29 void TearDown();
30 };
31
SetUpTestCase()32 void CryptoOsslCommonTest::SetUpTestCase() {}
TearDownTestCase()33 void CryptoOsslCommonTest::TearDownTestCase() {}
SetUp()34 void CryptoOsslCommonTest::SetUp() {}
TearDown()35 void CryptoOsslCommonTest::TearDown() {}
36
37 HWTEST_F(CryptoOsslCommonTest, CryptoOsslCommonTest01, TestSize.Level0)
38 {
39 HcfResult ret = GetCurveNameByCurveId(0, nullptr);
40 EXPECT_EQ(ret, HCF_INVALID_PARAMS);
41 }
42
43 HWTEST_F(CryptoOsslCommonTest, CryptoOsslCommonTest02, TestSize.Level0)
44 {
45 HcfResult ret = GetNidByCurveNameValue(0, nullptr);
46 EXPECT_EQ(ret, HCF_INVALID_PARAMS);
47 }
48
49 HWTEST_F(CryptoOsslCommonTest, CryptoOsslCommonTest03, TestSize.Level0)
50 {
51 HcfResult ret = GetGroupNameByNid(0, nullptr);
52 EXPECT_EQ(ret, HCF_INVALID_PARAMS);
53 }
54
55 HWTEST_F(CryptoOsslCommonTest, CryptoOsslCommonTest04, TestSize.Level0)
56 {
57 HcfResult ret = GetFormatTypeByFormatValue(0, nullptr);
58 EXPECT_EQ(ret, HCF_INVALID_PARAMS);
59 }
60
61 HWTEST_F(CryptoOsslCommonTest, CryptoOsslCommonTest05, TestSize.Level0)
62 {
63 HcfResult ret = GetAlgNameByBits(0, nullptr);
64 EXPECT_EQ(ret, HCF_INVALID_PARAMS);
65 }
66
67 HWTEST_F(CryptoOsslCommonTest, CryptoOsslCommonTest06, TestSize.Level0)
68 {
69 HcfResult ret = GetOpensslCurveId(0, nullptr);
70 EXPECT_EQ(ret, HCF_INVALID_PARAMS);
71 }
72
73 HWTEST_F(CryptoOsslCommonTest, CryptoOsslCommonTest07, TestSize.Level0)
74 {
75 HcfResult ret = GetSm2SpecStringSm3(nullptr);
76 EXPECT_EQ(ret, HCF_INVALID_PARAMS);
77 }
78 }