diff --git a/hapsigntool_cpp_test/unittest/BUILD.gn b/hapsigntool_cpp_test/unittest/BUILD.gn index 56a21a38366b5306d66fe79552c0116e4d6fa24a..4a6a2233c6d144cf23988282c09b329fb9f9006d 100644 --- a/hapsigntool_cpp_test/unittest/BUILD.gn +++ b/hapsigntool_cpp_test/unittest/BUILD.gn @@ -65,14 +65,14 @@ ohos_unittest("hapsigntool_pc_unittest") { "./generateKeyPair/options_test.cpp", "./generateKeyPair/process_cmd_expansion_test.cpp", "./generateKeyPair/process_cmd_test.cpp", + "./hapSign/block_data_test.cpp", + "./hapSign/block_head_test.cpp", "./hapSign/hap_openssl_utils_test.cpp", "./hapSign/hap_sign_test.cpp", - "./hapSign/hw_block_data_test.cpp", - "./hapSign/hw_block_head_test.cpp", - "./hapSign/hw_sign_head_test.cpp", "./hapSign/sign_bin_test.cpp", "./hapSign/sign_block_data_test.cpp", "./hapSign/sign_elf_test.cpp", + "./hapSign/sign_head_test.cpp", "./hapSign/sign_provider_test.cpp", "./hapVerify/hap_cert_verify_openssl_utils_test.cpp", "./hapVerify/hap_signer_block_utils_test.cpp", @@ -84,6 +84,7 @@ ohos_unittest("hapsigntool_pc_unittest") { "./signProfile/provision_test.cpp", "./signProfile/sign_profile_test.cpp", "./utils/byte_array_utils_test.cpp", + "./utils/cert_tools_test.cpp", "./utils/file_utils_test.cpp", "./zip/random_access_file_input_output_test.cpp", "./zip/zip_signer_test.cpp", diff --git a/hapsigntool_cpp_test/unittest/codeSigning/utils/fs_digest_utils_test.cpp b/hapsigntool_cpp_test/unittest/codeSigning/utils/fs_digest_utils_test.cpp index a8f9d13739fb35e6ce165fb4f5b1544accff9f49..53872026f13ad52f606feb79e87702fd8adacfa6 100644 --- a/hapsigntool_cpp_test/unittest/codeSigning/utils/fs_digest_utils_test.cpp +++ b/hapsigntool_cpp_test/unittest/codeSigning/utils/fs_digest_utils_test.cpp @@ -17,9 +17,9 @@ #include #include "fs_digest_utils.h" - /* - * 测试套件,固定写法 - */ +namespace OHOS { +namespace SignatureTools { + class DigestUtilsTest : public testing::Test { public: static void SetUpTestCase(void) @@ -93,3 +93,5 @@ HWTEST_F(DigestUtilsTest, result, testing::ext::TestSize.Level1) EXPECT_EQ(str.size(), 64); } +} // namespace SignatureTools +} // namespace OHOS \ No newline at end of file diff --git a/hapsigntool_cpp_test/unittest/elfVerify/verify_elf_test.cpp b/hapsigntool_cpp_test/unittest/elfVerify/verify_elf_test.cpp index d08fd629819d40cdd00eae4ca9de53c68fcafe4b..444b94f1c4cb751c6e5016870ad596e1410411a0 100644 --- a/hapsigntool_cpp_test/unittest/elfVerify/verify_elf_test.cpp +++ b/hapsigntool_cpp_test/unittest/elfVerify/verify_elf_test.cpp @@ -18,7 +18,7 @@ #include #include "verify_elf.h" -#include "hw_block_data.h" +#include "block_data.h" #include "sign_provider.h" #include "verify_hap.h" @@ -369,9 +369,9 @@ HWTEST_F(VerifyElfTest, CheckSignFile, testing::ext::TestSize.Level1) HWTEST_F(VerifyElfTest, GetSignBlockData, testing::ext::TestSize.Level1) { std::vector bytes = { 1, 1, 1, 1, 1, 1, 1, 1 }; - HwBlockData hwBlockData(0, 0); + BlockData blockData(0, 0); - bool flag = VerifyElf::GetSignBlockData(bytes, hwBlockData, "elf"); + bool flag = VerifyElf::GetSignBlockData(bytes, blockData, "elf"); EXPECT_EQ(flag, false); } diff --git a/hapsigntool_cpp_test/unittest/hapSign/hw_block_data_test.cpp b/hapsigntool_cpp_test/unittest/hapSign/block_data_test.cpp similarity index 64% rename from hapsigntool_cpp_test/unittest/hapSign/hw_block_data_test.cpp rename to hapsigntool_cpp_test/unittest/hapSign/block_data_test.cpp index 938fb777637d35dab75d10c578fd49ff242e99f0..26e322ef4abe6af149bf311634cc295adc882656 100644 --- a/hapsigntool_cpp_test/unittest/hapSign/hw_block_data_test.cpp +++ b/hapsigntool_cpp_test/unittest/hapSign/block_data_test.cpp @@ -14,7 +14,7 @@ */ #include #include -#include "hw_block_data.h" +#include "block_data.h" namespace OHOS { namespace SignatureTools { @@ -22,7 +22,7 @@ namespace SignatureTools { /* * 测试套件,固定写法 */ -class HwBlockDataTest : public testing::Test { +class BlockDataTest : public testing::Test { public: static void SetUpTestCase(void) { @@ -40,60 +40,60 @@ public: /** * @tc.name: GetBlockNum - * @tc.desc: Test function of HwBlockDataTest::GetBlockNum() interface for SUCCESS. + * @tc.desc: Test function of BlockDataTest::GetBlockNum() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC * @tc.level Level 1 * @tc.require: SR000H63TL */ -HWTEST_F(HwBlockDataTest, GetBlockNum, testing::ext::TestSize.Level1) +HWTEST_F(BlockDataTest, GetBlockNum, testing::ext::TestSize.Level1) { - std::shared_ptr api = std::make_shared(2, 0); + std::shared_ptr api = std::make_shared(2, 0); int32_t blockNum = api->GetBlockNum(); EXPECT_EQ(blockNum, 2); } /** * @tc.name: GetBlockStart - * @tc.desc: Test function of HwBlockDataTest::GetBlockStart() interface for SUCCESS. + * @tc.desc: Test function of BlockDataTest::GetBlockStart() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC * @tc.level Level 1 * @tc.require: SR000H63TL */ -HWTEST_F(HwBlockDataTest, GetBlockStart, testing::ext::TestSize.Level1) +HWTEST_F(BlockDataTest, GetBlockStart, testing::ext::TestSize.Level1) { - std::shared_ptr api = std::make_shared(2, 0); + std::shared_ptr api = std::make_shared(2, 0); int32_t blockStart = api->GetBlockStart(); EXPECT_EQ(blockStart, 0); } /** * @tc.name: SetBlockNum - * @tc.desc: Test function of HwBlockDataTest::SetBlockNum() interface for SUCCESS. + * @tc.desc: Test function of BlockDataTest::SetBlockNum() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC * @tc.level Level 1 * @tc.require: SR000H63TL */ -HWTEST_F(HwBlockDataTest, SetBlockNum, testing::ext::TestSize.Level1) +HWTEST_F(BlockDataTest, SetBlockNum, testing::ext::TestSize.Level1) { - std::shared_ptr api = std::make_shared(2, 0); + std::shared_ptr api = std::make_shared(2, 0); api->SetBlockNum(3); EXPECT_EQ(true, 1); } /** * @tc.name: SetBlockStart - * @tc.desc: Test function of HwBlockDataTest::SetBlockStart() interface for SUCCESS. + * @tc.desc: Test function of BlockDataTest::SetBlockStart() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC * @tc.level Level 1 * @tc.require: SR000H63TL */ -HWTEST_F(HwBlockDataTest, SetBlockStart, testing::ext::TestSize.Level1) +HWTEST_F(BlockDataTest, SetBlockStart, testing::ext::TestSize.Level1) { - std::shared_ptr api = std::make_shared(2, 0); + std::shared_ptr api = std::make_shared(2, 0); api->SetBlockStart(1); EXPECT_EQ(true, 1); } diff --git a/hapsigntool_cpp_test/unittest/hapSign/hw_block_head_test.cpp b/hapsigntool_cpp_test/unittest/hapSign/block_head_test.cpp similarity index 73% rename from hapsigntool_cpp_test/unittest/hapSign/hw_block_head_test.cpp rename to hapsigntool_cpp_test/unittest/hapSign/block_head_test.cpp index 489e3795b69f61ea4193f020978ceb5761c7f477..a73d219fc04e251ee3c6ffbedd0f9125566983c1 100644 --- a/hapsigntool_cpp_test/unittest/hapSign/hw_block_head_test.cpp +++ b/hapsigntool_cpp_test/unittest/hapSign/block_head_test.cpp @@ -14,7 +14,7 @@ */ #include #include -#include "hw_block_head.h" +#include "block_head.h" namespace OHOS { namespace SignatureTools { @@ -22,7 +22,7 @@ namespace SignatureTools { /* * 测试套件,固定写法 */ -class HwBlockHeadTest : public testing::Test { +class BlockHeadTest : public testing::Test { public: static void SetUpTestCase(void) { @@ -46,9 +46,9 @@ public: * @tc.level Level 1 * @tc.require: SR000H63TL */ -HWTEST_F(HwBlockHeadTest, GetBlockHead, testing::ext::TestSize.Level1) +HWTEST_F(BlockHeadTest, GetBlockHead, testing::ext::TestSize.Level1) { - std::shared_ptr api = std::make_shared(); + std::shared_ptr api = std::make_shared(); std::string blockHead = api->GetBlockHead(0, 0, 0, 29148868); EXPECT_NE(blockHead.size(), 0); } @@ -61,9 +61,9 @@ HWTEST_F(HwBlockHeadTest, GetBlockHead, testing::ext::TestSize.Level1) * @tc.level Level 1 * @tc.require: SR000H63TL */ -HWTEST_F(HwBlockHeadTest, GetBlockHeadLittleEndian, testing::ext::TestSize.Level1) +HWTEST_F(BlockHeadTest, GetBlockHeadLittleEndian, testing::ext::TestSize.Level1) { - std::shared_ptr api = std::make_shared(); + std::shared_ptr api = std::make_shared(); api->GetBlockHeadLittleEndian(0, 0, 0, 29148868); EXPECT_EQ(true, 1); } @@ -76,9 +76,9 @@ HWTEST_F(HwBlockHeadTest, GetBlockHeadLittleEndian, testing::ext::TestSize.Level * @tc.level Level 1 * @tc.require: SR000H63TL */ -HWTEST_F(HwBlockHeadTest, getBlockHeadLittleEndian, testing::ext::TestSize.Level1) +HWTEST_F(BlockHeadTest, getBlockHeadLittleEndian, testing::ext::TestSize.Level1) { - std::shared_ptr api = std::make_shared(); + std::shared_ptr api = std::make_shared(); api->GetBlockHeadLittleEndian(0, 0, 0, 29148868); EXPECT_EQ(true, 1); } @@ -91,9 +91,9 @@ HWTEST_F(HwBlockHeadTest, getBlockHeadLittleEndian, testing::ext::TestSize.Level * @tc.level Level 1 * @tc.require: SR000H63TL */ -HWTEST_F(HwBlockHeadTest, GetBlockLen, testing::ext::TestSize.Level1) +HWTEST_F(BlockHeadTest, GetBlockLen, testing::ext::TestSize.Level1) { - std::shared_ptr api = std::make_shared(); + std::shared_ptr api = std::make_shared(); int blockLen = api->GetBlockLen(); EXPECT_EQ(blockLen, 8); } @@ -106,9 +106,9 @@ HWTEST_F(HwBlockHeadTest, GetBlockLen, testing::ext::TestSize.Level1) * @tc.level Level 1 * @tc.require: SR000H63TL */ -HWTEST_F(HwBlockHeadTest, GetElfBlockLen, testing::ext::TestSize.Level1) +HWTEST_F(BlockHeadTest, GetElfBlockLen, testing::ext::TestSize.Level1) { - std::shared_ptr api = std::make_shared(); + std::shared_ptr api = std::make_shared(); int elfBlockLen = api->GetElfBlockLen(); EXPECT_EQ(elfBlockLen, 12); } diff --git a/hapsigntool_cpp_test/unittest/hapSign/hw_sign_head_test.cpp b/hapsigntool_cpp_test/unittest/hapSign/sign_head_test.cpp similarity index 81% rename from hapsigntool_cpp_test/unittest/hapSign/hw_sign_head_test.cpp rename to hapsigntool_cpp_test/unittest/hapSign/sign_head_test.cpp index fa5c2c4c89a2e23f9e5cd07abd82593227b8e00b..86d35be48823093d7b6d1b8231be5c77bb37943a 100644 --- a/hapsigntool_cpp_test/unittest/hapSign/hw_sign_head_test.cpp +++ b/hapsigntool_cpp_test/unittest/hapSign/sign_head_test.cpp @@ -14,7 +14,7 @@ */ #include #include -#include "hw_sign_head.h" +#include "sign_head.h" namespace OHOS { namespace SignatureTools { @@ -22,7 +22,7 @@ namespace SignatureTools { /* * 测试套件,固定写法 */ -class HwSignHeadTest : public testing::Test { +class SignHeadTest : public testing::Test { public: static void SetUpTestCase(void) { @@ -46,9 +46,9 @@ public: * @tc.level Level 1 * @tc.require: SR000H63TL */ -HWTEST_F(HwSignHeadTest, GetSignHead, testing::ext::TestSize.Level1) +HWTEST_F(SignHeadTest, GetSignHead, testing::ext::TestSize.Level1) { - std::shared_ptr api = std::make_shared(); + std::shared_ptr api = std::make_shared(); std::vector signHead = api->GetSignHead(5254); EXPECT_EQ(signHead.size(), 32); } @@ -61,9 +61,9 @@ HWTEST_F(HwSignHeadTest, GetSignHead, testing::ext::TestSize.Level1) * @tc.level Level 1 * @tc.require: SR000H63TL */ -HWTEST_F(HwSignHeadTest, getSignHeadLittleEndian, testing::ext::TestSize.Level1) +HWTEST_F(SignHeadTest, getSignHeadLittleEndian, testing::ext::TestSize.Level1) { - std::shared_ptr api = std::make_shared(); + std::shared_ptr api = std::make_shared(); std::vector signHeadLittleEndian = api->GetSignHeadLittleEndian(1024, 1); EXPECT_EQ(signHeadLittleEndian.size(), 32); }