diff --git a/startup_lite/syspara_hal/src/parameter_func_test.c b/startup_lite/syspara_hal/src/parameter_func_test.c index 4536785d01f4e150eb023979a254d4345a8748bc..07a75e788f6bf2b9aa7de4d2e1a0689424a4986f 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 { const char* value = GetDeviceType(); printf("Device Type=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -74,7 +74,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara002, Function | MediumTe { const char* value = GetManufacture(); printf("Manufacture=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -86,7 +86,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara003, Function | MediumTe { const char* value = GetBrand(); printf("Brand=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -98,7 +98,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara004, Function | MediumTe { const char* value = GetMarketName(); printf("Market Name=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -110,7 +110,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara005, Function | MediumTe { const char* value = GetProductSeries(); printf("Product Series=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -122,7 +122,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara006, Function | MediumTe { const char* value = GetProductModel(); printf("Product Model=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -134,7 +134,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara007, Function | MediumTe { const char* value = GetHardwareModel(); printf("Hardware Model=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -146,7 +146,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara008, Function | MediumTe { const char* value = GetHardwareProfile(); printf("Hardware Profile=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -158,7 +158,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara009, Function | MediumTe { const char* value = GetSerial(); printf("Serial=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -170,7 +170,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara010, Function | MediumTe { const char* value = GetOSFullName(); printf("Os Name=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -182,7 +182,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara011, Function | MediumTe { const char* value = GetDisplayVersion(); printf("Display Version=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -194,7 +194,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara012, Function | MediumTe { const char* value = GetBootloaderVersion(); printf("Bootloader Version=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -206,7 +206,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara013, Function | MediumTe { const char* value = GetSecurityPatchTag(); printf("Secure Patch Level=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -218,7 +218,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara014, Function | MediumTe { const char* value = GetAbiList(); printf("Abi List=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -230,8 +230,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara015, Function | MediumTe { int value = GetFirstApiVersion(); printf("First Api Level=%d\n", value); - TEST_ASSERT_NOT_NULL(value); - TEST_ASSERT_TRUE((int)value == value); + TEST_ASSERT_TRUE(value > 0); }; /** @@ -243,7 +242,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara016, Function | MediumTe { const char* value = GetIncrementalVersion(); printf("Incremental Version=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -255,7 +254,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara017, Function | MediumTe { const char* value = GetVersionId(); printf("Version Id=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -267,7 +266,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara018, Function | MediumTe { const char* value = GetBuildType(); printf("Build Type=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -279,7 +278,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara019, Function | MediumTe { const char* value = GetBuildUser(); printf("Build User=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -291,7 +290,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara020, Function | MediumTe { const char* value = GetBuildHost(); printf("Build Host=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -303,7 +302,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara021, Function | MediumTe { const char* value = GetBuildTime(); printf("Build Time=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -315,7 +314,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara022, Function | MediumTe { const char* value = GetBuildRootHash(); printf("Build Root Hash=%s\n", value); - IsEmpty(value); + TEST_ASSERT_NOT_NULL(value); }; /** @@ -327,7 +326,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara023, Function | MediumTe { const char* value = GetSoftwareModel(); printf("Software Model=%s\n", value); - IsEmpty(value); + AssertNotEmpty(value); }; /** @@ -339,8 +338,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara024, Function | MediumTe { int value = GetSdkApiVersion(); printf("Sdk Api Level=%d\n", value); - TEST_ASSERT_NOT_NULL(value); - TEST_ASSERT_TRUE((int)value == value); + TEST_ASSERT_TRUE(value > 0); }; /** diff --git a/startup_lite/syspara_hal/src/parameter_reli_test.c b/startup_lite/syspara_hal/src/parameter_reli_test.c index 1a263144e96399e5b0f1e28471774dd4d47a05db..7dbaf43a0138a06fedf223793fc390d82cb67110 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) { const char* value1 = GetDeviceType(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetDeviceType(); @@ -73,7 +73,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli001, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli002, Function | MediumTest | Level1) { const char* value1 = GetManufacture(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetManufacture(); @@ -90,7 +90,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli002, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli003, Function | MediumTest | Level1) { const char* value1 = GetBrand(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetBrand(); @@ -107,7 +107,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli003, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli004, Function | MediumTest | Level1) { const char* value1 = GetMarketName(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetMarketName(); @@ -124,7 +124,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli004, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli005, Function | MediumTest | Level1) { const char* value1 = GetProductSeries(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetProductSeries(); @@ -141,7 +141,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli005, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli006, Function | MediumTest | Level1) { const char* value1 = GetProductModel(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetProductModel(); @@ -158,7 +158,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli006, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli007, Function | MediumTest | Level1) { const char* value1 = GetHardwareModel(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetHardwareModel(); @@ -175,7 +175,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli007, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli008, Function | MediumTest | Level1) { const char* value1 = GetHardwareProfile(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetHardwareProfile(); @@ -212,7 +212,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli009, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli010, Function | MediumTest | Level1) { const char* value1 = GetOSFullName(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetOSFullName(); @@ -229,7 +229,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli010, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli011, Function | MediumTest | Level1) { const char* value1 = GetDisplayVersion(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetDisplayVersion(); @@ -246,7 +246,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli011, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli012, Function | MediumTest | Level1) { const char* value1 = GetBootloaderVersion(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetBootloaderVersion(); @@ -263,7 +263,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli012, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli013, Function | MediumTest | Level1) { const char* value1 = GetSecurityPatchTag(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetSecurityPatchTag(); @@ -280,7 +280,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli013, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli014, Function | MediumTest | Level1) { const char* value1 = GetAbiList(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetAbiList(); @@ -315,7 +315,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli015, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli016, Function | MediumTest | Level1) { const char* value1 = GetIncrementalVersion(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetIncrementalVersion(); @@ -332,7 +332,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli016, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli017, Function | MediumTest | Level1) { const char* value1 = GetVersionId(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetVersionId(); @@ -349,7 +349,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli017, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli018, Function | MediumTest | Level1) { const char* value1 = GetBuildType(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetBuildType(); @@ -366,7 +366,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli018, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli019, Function | MediumTest | Level1) { const char* value1 = GetBuildUser(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetBuildUser(); @@ -383,7 +383,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli019, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli020, Function | MediumTest | Level1) { const char* value1 = GetBuildHost(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetBuildHost(); @@ -400,7 +400,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli020, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli021, Function | MediumTest | Level1) { const char* value1 = GetBuildTime(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetBuildTime(); @@ -417,7 +417,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli021, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli022, Function | MediumTest | Level1) { const char* value1 = GetBuildRootHash(); - IsEmpty(value1); + TEST_ASSERT_NOT_NULL(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetBuildRootHash(); @@ -434,7 +434,7 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli022, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli023, Function | MediumTest | Level1) { const char* value1 = GetSoftwareModel(); - IsEmpty(value1); + AssertNotEmpty(value1); for (int i = 0; i < QUERY_TIMES; i++) { const char* value = GetSoftwareModel(); diff --git a/startup_lite/syspara_hal/src/parameter_utils.c b/startup_lite/syspara_hal/src/parameter_utils.c index 6e962dcdcb2c6c4c366a7fad8314ee76a28b39a8..0729aa306b5e35017423e566710d63df0ad63d80 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) { - if (strlen(sysPara) != 0) { - TEST_ASSERT_NOT_NULL(sysPara); - } + 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..d81d40cf83403c6626f574230f4bbf882b5666e2 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