diff --git a/startup_lite/syspara_hal/src/parameter_func_test.c b/startup_lite/syspara_hal/src/parameter_func_test.c index dc727aa3c8ff23629d56e4bfbf84f734be26e300..5c9f030544acb869c031ec680af05ee55e146591 100755 --- a/startup_lite/syspara_hal/src/parameter_func_test.c +++ b/startup_lite/syspara_hal/src/parameter_func_test.c @@ -62,7 +62,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara001, Function | MediumTe { char* value = GetProductType(); printf("Product Type=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -75,7 +75,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara002, Function | MediumTe { char* value = GetManufacture(); printf("Manufacture=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -88,7 +88,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara003, Function | MediumTe { char* value = GetBrand(); printf("Brand=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -101,7 +101,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara004, Function | MediumTe { char* value = GetMarketName(); printf("Market Name=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -114,7 +114,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara005, Function | MediumTe { char* value = GetProductSeries(); printf("Product Series=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -127,7 +127,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara006, Function | MediumTe { char* value = GetProductModel(); printf("Product Model=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -140,7 +140,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara007, Function | MediumTe { char* value = GetHardwareModel(); printf("Hardware Model=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -153,7 +153,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara008, Function | MediumTe { char* value = GetHardwareProfile(); printf("Hardware Profile=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -184,7 +184,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara010, Function | MediumTe { char* value = GetOsName(); printf("Os Name=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -197,7 +197,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara011, Function | MediumTe { char* value = GetDisplayVersion(); printf("Display Version=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -210,7 +210,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara012, Function | MediumTe { char* value = GetBootloaderVersion(); printf("Bootloader Version=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -223,7 +223,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara013, Function | MediumTe { char* value = GetSecurityPatchTag(); printf("Secure Patch Level=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -236,7 +236,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara014, Function | MediumTe { char* value = GetAbiList(); printf("Abi List=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -249,7 +249,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara015, Function | MediumTe { char* value = GetFirstApiLevel(); printf("First Api Level=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -262,7 +262,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara016, Function | MediumTe { char* value = GetIncrementalVersion(); printf("Incremental Version=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -275,7 +275,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara017, Function | MediumTe { char* value = GetVersionId(); printf("Version Id=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -288,7 +288,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara018, Function | MediumTe { char* value = GetBuildType(); printf("Build Type=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -301,7 +301,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara019, Function | MediumTe { char* value = GetBuildUser(); printf("Build User=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -314,7 +314,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara020, Function | MediumTe { char* value = GetBuildHost(); printf("Build Host=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -327,7 +327,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara021, Function | MediumTe { char* value = GetBuildTime(); printf("Build Time=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -340,7 +340,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara022, Function | MediumTe { char* value = GetBuildRootHash(); printf("Build Root Hash=%s\n", value); - IsEmpty(value); + TEST_ASSERT_NOT_NULL(value); free(value); }; @@ -353,7 +353,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara023, Function | MediumTe { char* value = GetSoftwareModel(); printf("Software Model=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; @@ -366,7 +366,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara024, Function | MediumTe { char* value = GetSdkApiLevel(); printf("Sdk Api Level=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); free(value); }; diff --git a/startup_lite/syspara_hal/src/parameter_reli_test.c b/startup_lite/syspara_hal/src/parameter_reli_test.c index f3231aa3ea9f7acf4ae0ceb7c4b0486de5b58d80..9860237853134a82602980deb911f1bcf4013629 100755 --- a/startup_lite/syspara_hal/src/parameter_reli_test.c +++ b/startup_lite/syspara_hal/src/parameter_reli_test.c @@ -56,7 +56,7 @@ static BOOL ParameterReliTestSuiteTearDown(void) LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli001, Function | MediumTest | Level1) { char* value1 = GetProductType(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetProductType(); @@ -76,7 +76,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli001, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli002, Function | MediumTest | Level1) { char* value1 = GetManufacture(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetManufacture(); @@ -96,7 +96,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli002, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli003, Function | MediumTest | Level1) { char* value1 = GetBrand(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetBrand(); @@ -116,7 +116,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli003, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli004, Function | MediumTest | Level1) { char* value1 = GetMarketName(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetMarketName(); @@ -136,7 +136,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli004, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli005, Function | MediumTest | Level1) { char* value1 = GetProductSeries(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetProductSeries(); @@ -156,7 +156,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli005, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli006, Function | MediumTest | Level1) { char* value1 = GetProductModel(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetProductModel(); @@ -176,7 +176,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli006, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli007, Function | MediumTest | Level1) { char* value1 = GetHardwareModel(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetHardwareModel(); @@ -196,7 +196,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli007, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli008, Function | MediumTest | Level1) { char* value1 = GetHardwareProfile(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetHardwareProfile(); @@ -239,7 +239,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli009, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli010, Function | MediumTest | Level1) { char* value1 = GetOsName(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetOsName(); @@ -259,7 +259,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli010, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli011, Function | MediumTest | Level1) { char* value1 = GetDisplayVersion(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetDisplayVersion(); @@ -279,7 +279,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli011, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli012, Function | MediumTest | Level1) { char* value1 = GetBootloaderVersion(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetBootloaderVersion(); @@ -299,7 +299,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli012, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli013, Function | MediumTest | Level1) { char* value1 = GetSecurityPatchTag(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetSecurityPatchTag(); @@ -319,7 +319,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli013, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli014, Function | MediumTest | Level1) { char* value1 = GetAbiList(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetAbiList(); @@ -339,7 +339,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli014, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli015, Function | MediumTest | Level1) { char* value1 = GetFirstApiLevel(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetFirstApiLevel(); @@ -359,7 +359,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli015, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli016, Function | MediumTest | Level1) { char* value1 = GetIncrementalVersion(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetIncrementalVersion(); @@ -379,7 +379,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli016, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli017, Function | MediumTest | Level1) { char* value1 = GetVersionId(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetVersionId(); @@ -399,7 +399,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli017, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli018, Function | MediumTest | Level1) { char* value1 = GetBuildType(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetBuildType(); @@ -419,7 +419,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli018, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli019, Function | MediumTest | Level1) { char* value1 = GetBuildUser(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetBuildUser(); @@ -439,7 +439,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli019, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli020, Function | MediumTest | Level1) { char* value1 = GetBuildHost(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetBuildHost(); @@ -459,7 +459,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli020, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli021, Function | MediumTest | Level1) { char* value1 = GetBuildTime(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetBuildTime(); @@ -479,7 +479,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli021, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli022, Function | MediumTest | Level1) { char* value1 = GetBuildRootHash(); - IsEmpty(value1); + TEST_ASSERT_NOT_NULL(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetBuildRootHash(); @@ -499,7 +499,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli022, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli023, Function | MediumTest | Level1) { char* value1 = GetSoftwareModel(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetSoftwareModel(); @@ -519,7 +519,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli023, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli024, Function | MediumTest | Level1) { char* value1 = GetSdkApiLevel(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { char* value = GetSdkApiLevel(); diff --git a/startup_lite/syspara_hal/src/parameter_utils.c b/startup_lite/syspara_hal/src/parameter_utils.c index d34c72f47f3afeab185446045b8caac10e0d8bb8..79897be725b4807e58455cfa42b5788b8f3a7cad 100755 --- a/startup_lite/syspara_hal/src/parameter_utils.c +++ b/startup_lite/syspara_hal/src/parameter_utils.c @@ -16,11 +16,10 @@ #include "hctest.h" #include "parameter_utils.h" -void IsEmpty(const char* sysPara) +void AssertNotEmpty(const char *sysPara) { + TEST_ASSERT_NOT_NULL(sysPara); if (sysPara != NULL) { - TEST_ASSERT_EQUAL_INT(1, 1); - } else { - TEST_FAIL(); - } + TEST_ASSERT_TRUE(strlen(sysPara) > 0); + } } \ No newline at end of file diff --git a/startup_lite/syspara_hal/src/parameter_utils.h b/startup_lite/syspara_hal/src/parameter_utils.h index f27c5295ae6c32b83d178c182e0d9c24ab42fec5..e5b112adb7aa062b1bfa684ecda569394980220a 100755 --- a/startup_lite/syspara_hal/src/parameter_utils.h +++ b/startup_lite/syspara_hal/src/parameter_utils.h @@ -25,7 +25,7 @@ * @tc.name :determines whether the string is empty. * @param :system parameter */ -void IsEmpty(const char* sysPara); +void AssertNotEmpty(const char *sysPara); #ifdef __cplusplus #if __cplusplus