From 3ef9c68dd8506e9b933257e66bab9fa941bd4f93 Mon Sep 17 00:00:00 2001 From: fuzikun Date: Wed, 14 Sep 2022 09:45:32 +0800 Subject: [PATCH] fixed 2e5d583 from https://gitee.com/fuzikun/security_crypto_framework/pulls/13 add tdd description Signed-off-by: fuzikun --- test/unittest/src/crypto_aes_cipher_test.cpp | 15 +++++++++++++-- .../src/crypto_ecc_asy_key_generator_test.cpp | 6 ++++++ test/unittest/src/crypto_md_test.cpp | 6 ++++++ test/unittest/src/crypto_rand_test.cpp | 6 ++++++ .../unittest/src/crypto_x509_certificate_test.cpp | 7 ++++++- 5 files changed, 37 insertions(+), 3 deletions(-) diff --git a/test/unittest/src/crypto_aes_cipher_test.cpp b/test/unittest/src/crypto_aes_cipher_test.cpp index c50e70c..f858dbc 100644 --- a/test/unittest/src/crypto_aes_cipher_test.cpp +++ b/test/unittest/src/crypto_aes_cipher_test.cpp @@ -115,7 +115,7 @@ static int32_t GeneratorFile(const char *fileName, int32_t genFileSize) } uint8_t buffer[FILE_BLOCK_SIZE] = {0}; std::ifstream file(fileName); - + if (file.good()) { file.close(); return 0; @@ -429,7 +429,12 @@ static int32_t AesNoUpdateDecrypt(HcfCipher *cipher, HcfSymKey *key, HcfParamsSp return ret; } - +/** + * @tc.name: AesEncryptTest.AesEncryptTest001 + * @tc.desc: Verify whether the crypto framework is normal. + * @tc.type: FUNC + * @tc.require: I5QWEO + */ HWTEST_F(AesEncryptTest, AesEncryptTest001, TestSize.Level0) { int ret = 0; @@ -476,6 +481,12 @@ clearup: EXPECT_NE(ret, 0); } +/** + * @tc.name: AesEncryptTest.AesEncryptTest002 + * @tc.desc: Verify AES128 cipher algorithm. + * @tc.type: FUNC + * @tc.require: I5QWEG + */ HWTEST_F(AesEncryptTest, AesEncryptTest002, TestSize.Level0) { int ret = 0; diff --git a/test/unittest/src/crypto_ecc_asy_key_generator_test.cpp b/test/unittest/src/crypto_ecc_asy_key_generator_test.cpp index bf27a80..7feabf4 100644 --- a/test/unittest/src/crypto_ecc_asy_key_generator_test.cpp +++ b/test/unittest/src/crypto_ecc_asy_key_generator_test.cpp @@ -129,6 +129,12 @@ static HcfObjectBase obj = { .destroy = NULL }; +/** + * @tc.name: EccAsyKeyGeneratorTest.EccAsyKeyGeneratorTest001 + * @tc.desc: Verify that the creation of the ECC224 key pair generator is normal. + * @tc.type: FUNC + * @tc.require: I5QWEI + */ HWTEST_F(EccAsyKeyGeneratorTest, EccAsyKeyGeneratorTest001, TestSize.Level0) { HcfAsyKeyGenerator *generator = NULL; diff --git a/test/unittest/src/crypto_md_test.cpp b/test/unittest/src/crypto_md_test.cpp index 72ddd61..b15cf91 100644 --- a/test/unittest/src/crypto_md_test.cpp +++ b/test/unittest/src/crypto_md_test.cpp @@ -66,6 +66,12 @@ static void PrintfBlobInHex(uint8_t *data, size_t dataLen) printf("\n"); } +/** + * @tc.name: CryptoFrameworkMdTest.CryptoFrameworkMdCreateTest001 + * @tc.desc: Verify that the creation of the SHA1 Md obj is normal. + * @tc.type: FUNC + * @tc.require: I5QWEM + */ HWTEST_F(CryptoFrameworkMdTest, CryptoFrameworkMdCreateTest001, TestSize.Level0) { int32_t ret = 0; diff --git a/test/unittest/src/crypto_rand_test.cpp b/test/unittest/src/crypto_rand_test.cpp index 53cc0d2..12b41fd 100644 --- a/test/unittest/src/crypto_rand_test.cpp +++ b/test/unittest/src/crypto_rand_test.cpp @@ -43,6 +43,12 @@ void CryptoFrameworkRandTest::TearDown() // add destroy here, this will be calle { } +/** + * @tc.name: CryptoFrameworkRandTest.CryptoFrameworkRandCreateTest001 + * @tc.desc: Verify that the creation of the random obj is normal. + * @tc.type: FUNC + * @tc.require: I5QWEN + */ HWTEST_F(CryptoFrameworkRandTest, CryptoFrameworkRandCreateTest001, TestSize.Level0) { int32_t ret = 0; diff --git a/test/unittest/src/crypto_x509_certificate_test.cpp b/test/unittest/src/crypto_x509_certificate_test.cpp index 3a3d178..625cb9f 100644 --- a/test/unittest/src/crypto_x509_certificate_test.cpp +++ b/test/unittest/src/crypto_x509_certificate_test.cpp @@ -260,7 +260,12 @@ void X509CertTest::TearDown() { } -/* Valid PEM format. */ +/** + * @tc.name: X509CertTest.GenerateCert001 + * @tc.desc: Generate valid PEM format certificate. + * @tc.type: FUNC + * @tc.require: I5QDNN + */ HWTEST_F(X509CertTest, GenerateCert001, TestSize.Level0) { HcfX509Certificate *x509Cert = nullptr; -- Gitee