From 4a2054d94728687f4a54d77d52a7388c0d5874f5 Mon Sep 17 00:00:00 2001 From: nan-xiansen Date: Thu, 22 Jul 2021 16:06:32 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90startup=5Flite=E3=80=91=E3=80=90master?= =?UTF-8?q?=E3=80=91syspara=5Fhal:fix=20the=20problematic=20use=20cases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nan-xiansen Change-Id: I083910507f131414336e97d446f4162f65962bc6 --- .../syspara_hal/src/parameter_func_test.c | 17 +++++++---------- .../syspara_hal/src/parameter_reli_test.c | 6 ++++-- startup_lite/syspara_hal/src/parameter_utils.c | 8 ++++---- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/startup_lite/syspara_hal/src/parameter_func_test.c b/startup_lite/syspara_hal/src/parameter_func_test.c index 617f878f2..4536785d0 100755 --- a/startup_lite/syspara_hal/src/parameter_func_test.c +++ b/startup_lite/syspara_hal/src/parameter_func_test.c @@ -55,13 +55,13 @@ static BOOL ParameterFuncTestSuiteTearDown(void) /** * @tc.number : SUB_UTILS_PARAMETER_0100 - * @tc.name : Obtaining system parameter ProductType + * @tc.name : Obtaining system parameter DeviceType * @tc.desc : [C- SOFTWARE -0200] */ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara001, Function | MediumTest | Level1) { const char* value = GetDeviceType(); - printf("Product Type=%s\n", value); + printf("Device Type=%s\n", value); IsEmpty(value); }; @@ -158,12 +158,7 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara009, Function | MediumTe { const char* value = GetSerial(); printf("Serial=%s\n", value); - if (value == NULL) { - printf("The serial number needs to be written\n"); - TEST_IGNORE(); - } else { - TEST_ASSERT_EQUAL_INT(1, 1); - } + IsEmpty(value); }; /** @@ -235,7 +230,8 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara015, Function | MediumTe { int value = GetFirstApiVersion(); printf("First Api Level=%d\n", value); - IsEmpty(value); + TEST_ASSERT_NOT_NULL(value); + TEST_ASSERT_TRUE((int)value == value); }; /** @@ -343,7 +339,8 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara024, Function | MediumTe { int value = GetSdkApiVersion(); printf("Sdk Api Level=%d\n", value); - IsEmpty(value); + TEST_ASSERT_NOT_NULL(value); + TEST_ASSERT_TRUE((int)value == value); }; /** diff --git a/startup_lite/syspara_hal/src/parameter_reli_test.c b/startup_lite/syspara_hal/src/parameter_reli_test.c index 7de35e169..1a263144e 100755 --- a/startup_lite/syspara_hal/src/parameter_reli_test.c +++ b/startup_lite/syspara_hal/src/parameter_reli_test.c @@ -297,7 +297,8 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli014, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli015, Function | MediumTest | Level1) { int value1 = GetFirstApiVersion(); - IsEmpty(value1); + TEST_ASSERT_NOT_NULL(value1); + TEST_ASSERT_TRUE((int)value1 == value1); for (int i = 0; i < QUERY_TIMES; i++) { int value = GetFirstApiVersion(); @@ -450,7 +451,8 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli023, Function | Medi LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli024, Function | MediumTest | Level1) { int value1 = GetSdkApiVersion(); - IsEmpty(value1); + TEST_ASSERT_NOT_NULL(value1); + TEST_ASSERT_TRUE((int)value1 == value1); for (int i = 0; i < QUERY_TIMES; i++) { int value = GetSdkApiVersion(); diff --git a/startup_lite/syspara_hal/src/parameter_utils.c b/startup_lite/syspara_hal/src/parameter_utils.c index d34c72f47..6e962dcdc 100755 --- a/startup_lite/syspara_hal/src/parameter_utils.c +++ b/startup_lite/syspara_hal/src/parameter_utils.c @@ -19,8 +19,8 @@ void IsEmpty(const char* sysPara) { if (sysPara != NULL) { - TEST_ASSERT_EQUAL_INT(1, 1); - } else { - TEST_FAIL(); - } + if (strlen(sysPara) != 0) { + TEST_ASSERT_NOT_NULL(sysPara); + } + } } \ No newline at end of file -- GitLab