提交 7fdb52d1 编写于 作者: L leiyuqian

startuplite xts modify

Signed-off-by: Nleiyuqian <leiyuqian1@huawei.com>
Change-Id: I0a4acfaff9f36142852b7e218e2d970a6ccc60f4
上级 065881a6
...@@ -16,6 +16,7 @@ import("//test/xts/tools/lite/build/suite_lite.gni") ...@@ -16,6 +16,7 @@ import("//test/xts/tools/lite/build/suite_lite.gni")
hctest_suite("ActsParameterTest") { hctest_suite("ActsParameterTest") {
suite_name = "acts" suite_name = "acts"
sources = [ sources = [
"src/deviceinfo_func_test.c",
"src/parameter_func_test.c", "src/parameter_func_test.c",
"src/parameter_reli_test.c", "src/parameter_reli_test.c",
"src/parameter_utils.c", "src/parameter_utils.c",
......
/*
* Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <securec.h>
#include "hctest.h"
#include "ohos_types.h"
#include "parameter.h"
#include "parameter_utils.h"
#define MAX_LEN 128
#define INVALID_LEN 2
#define COMMON_ERROR (-1)
#define INVALID_PARAMETER (-9)
static const char* g_defSysParam = "data of sys param ***...";
/**
* @tc.desc : register a test suite, this suite is used to test basic flow
* and interface dependency
* @param : subsystem name is utils
* @param : module name is parameter
* @param : test suit name is DeviceInfoFuncTestSuite
*/
LITE_TEST_SUIT(startup, deviceinfo, DeviceInfoFuncTestSuite);
/**
* @tc.setup : setup for all testcases
* @return : setup result, TRUE is success, FALSE is fail
*/
static BOOL DeviceInfoFuncTestSuiteSetUp(void) {
return TRUE;
}
/**
* @tc.teardown : teardown for all testcases
* @return : teardown result, TRUE is success, FALSE is fail
*/
static BOOL DeviceInfoFuncTestSuiteTearDown(void) {
printf("+--------------------------------------------+\n");
return TRUE;
}
/**
* @tc.name : testGetDeviceTypeFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0100
* @tc.desc : test obtaining device info DeviceType is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetDeviceTypeFun001,
Function | MediumTest | Level1) {
const char* value = GetDeviceType();
printf("Device Type=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetDeviceTypeFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0200
* @tc.desc : test obtaining device info DeviceType that less than 32
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetDeviceTypeFun002,
Function | MediumTest | Level1) {
const char* value = GetDeviceType();
printf("Device Type=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 32);
}
};
/**
* @tc.name : testGetManufactureFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0300
* @tc.desc : test obtaining device info Manufacture is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetManufactureFun001,
Function | MediumTest | Level1) {
const char* value = GetManufacture();
printf("Manufacture=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetManufactureFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0400
* @tc.desc : test obtaining device info Manufacture that less than 32
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetManufactureFun002,
Function | MediumTest | Level1) {
const char* value = GetManufacture();
printf("Manufacture=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 32);
}
};
/**
* @tc.name : testGetBrandFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0500
* @tc.desc : test obtaining device info Brand is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetBrandFun001,
Function | MediumTest | Level1) {
const char* value = GetBrand();
printf("Brand=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetBrandFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0600
* @tc.desc : test obtaining device info Brand that less than 32
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetBrandFun002,
Function | MediumTest | Level1) {
const char* value = GetBrand();
printf("Brand=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 32);
}
};
/**
* @tc.name : testGetMarketNameFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0700
* @tc.desc : test obtaining device info MarketName is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetMarketNameFun001,
Function | MediumTest | Level1) {
const char* value = GetMarketName();
printf("Market Name=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetMarketNameFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0800
* @tc.desc : test obtaining device info MarketName that less than 32
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetMarketNameFun002,
Function | MediumTest | Level1) {
const char* value = GetMarketName();
printf("Market Name=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 32);
}
};
/**
* @tc.name : testGetProductSeriesFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0900
* @tc.desc : test obtaining device info ProductSeries is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetProductSeriesFun001,
Function | MediumTest | Level1) {
const char* value = GetProductSeries();
printf("Product Series=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetProductSeriesFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1000
* @tc.desc : test obtaining device info ProductSeries that less than 32
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetProductSeriesFun002,
Function | MediumTest | Level1) {
const char* value = GetProductSeries();
printf("Product Series=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 32);
}
};
/**
* @tc.name : testGetProductModelFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1100
* @tc.desc : test obtaining device info ProductModel is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetProductModelFun001,
Function | MediumTest | Level1) {
const char* value = GetProductModel();
printf("Product Model=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetProductModelFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1200
* @tc.desc : test obtaining device info ProductModel that less than 32
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetProductModelFun002,
Function | MediumTest | Level1) {
const char* value = GetProductModel();
printf("Product Model=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 32);
}
};
/**
* @tc.name : testGetHardwareModel001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1300
* @tc.desc : test obtaining device info HardwareModel is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetHardwareModel001,
Function | MediumTest | Level1) {
const char* value = GetHardwareModel();
printf("Hardware Model=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetHardwareModel002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1400
* @tc.desc : test obtaining device info HardwareModel that less than 32
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetHardwareModel002,
Function | MediumTest | Level1) {
const char* value = GetHardwareModel();
printf("Hardware Model=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 32);
}
};
/**
* @tc.name : testGetSerialFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1500
* @tc.desc : test obtaining device info Serial is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetSerialFun001,
Function | MediumTest | Level1) {
const char* value = GetSerial();
printf("Serial=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetSerialFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1600
* @tc.desc : test obtaining device info Serial that less than 64
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetSerialFun002,
Function | MediumTest | Level1) {
const char* value = GetSerial();
printf("Serial=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 64);
}
};
/**
* @tc.name : testGetOSFullNameFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1700
* @tc.desc : test obtaining device info OSFullName is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetOSFullNameFun001,
Function | MediumTest | Level1) {
const char* value = GetOSFullName();
printf("Os Name=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetOSFullNameFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1800
* @tc.desc : test obtaining device info OSFullName that less than 64
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetOSFullNameFun002,
Function | MediumTest | Level1) {
const char* value = GetOSFullName();
printf("Os Name=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 64);
}
};
/**
* @tc.name : testGetDisplayVersionFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1900
* @tc.desc : test obtaining device info DisplayVersion is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetDisplayVersionFun001,
Function | MediumTest | Level1) {
const char* value = GetDisplayVersion();
printf("Display Version=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetDisplayVersionFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2000
* @tc.desc : test obtaining device info DisplayVersion that less than 64
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetDisplayVersionFun002,
Function | MediumTest | Level1) {
const char* value = GetDisplayVersion();
printf("Display Version=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 64);
}
};
/**
* @tc.name : testGetBootloaderVersionFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2100
* @tc.desc : test obtaining device info BootloaderVersion is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetBootloaderVersionFun001,
Function | MediumTest | Level1) {
const char* value = GetBootloaderVersion();
printf("Bootloader Version=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetBootloaderVersionFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2200
* @tc.desc : test obtaining device info BootloaderVersion that less
* than 64 characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetBootloaderVersionFun002,
Function | MediumTest | Level1) {
const char* value = GetBootloaderVersion();
printf("Bootloader Version=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 64);
}
};
/**
* @tc.name : testGetSecurityPatchTagFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2300
* @tc.desc : test obtaining device info SecurityPatchTag is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetSecurityPatchTagFun001,
Function | MediumTest | Level1) {
const char* value = GetSecurityPatchTag();
printf("Secure Patch Level=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetSecurityPatchTagFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2400
* @tc.desc : test obtaining device info SecurityPatchTag that less
* than 64 characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetSecurityPatchTagFun002,
Function | MediumTest | Level1) {
const char* value = GetSecurityPatchTag();
printf("Secure Patch Level=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 64);
}
};
/**
* @tc.name : testGetSecurityPatchTagFun003
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2500
* @tc.desc : test obtaining device info SecurityPatchTag which format is
* yy-mm-dd
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetSecurityPatchTagFun003,
Function | MediumTest | Level1) {
const char* value = GetSecurityPatchTag();
printf("Secure Patch Level=%s\n", value);
int year, month, day;
sscanf(value, "%04d-%02d-%02d", &year, &month, &day);
printf("%04d-%02d-%02d\n", year, month, day);
TEST_ASSERT_TRUE(year > 1900 && year < 2056);
TEST_ASSERT_TRUE(month <= 12 && month > 0);
TEST_ASSERT_TRUE(day <= 31 && day > 0);
char str[10] = {0};
sprintf(str, "%d-%02d-%02d", year, month, day);
printf("str=%s\n", str);
TEST_ASSERT_EQUAL_STRING(str, value);
};
/**
* @tc.name : testGetAbiListFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2600
* @tc.desc : test obtaining device info AbiList is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetAbiListFun001,
Function | MediumTest | Level1) {
const char* value = GetAbiList();
printf("Abi List=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetAbiListFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2700
* @tc.desc : test obtaining device info AbiList that less than 64
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetAbiListFun002,
Function | MediumTest | Level1) {
const char* value = GetAbiList();
printf("Abi List=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 64);
}
};
/**
* @tc.name : testGetSdkApiVersionFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2800
* @tc.desc : test obtaining device info SdkApiVersion is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetSdkApiVersionFun001,
Function | MediumTest | Level1) {
int value = GetSdkApiVersion();
printf("Sdk Api Level=%d\n", value);
TEST_ASSERT_TRUE(value > 0);
};
/**
* @tc.name : testGetFirstApiVersionFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2900
* @tc.desc : test obtaining device info FirstApiVersion is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetFirstApiVersionFun001,
Function | MediumTest | Level1) {
int value = GetFirstApiVersion();
printf("First Api Level=%d\n", value);
TEST_ASSERT_TRUE(value > 0);
};
/**
* @tc.name : testGetIncrementalVersionFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3000
* @tc.desc : test obtaining device info IncrementalVersion is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetIncrementalVersionFun001,
Function | MediumTest | Level1) {
const char* value = GetIncrementalVersion();
printf("Incremental Version=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetVersionIdFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3100
* @tc.desc : test obtaining device info VersionId is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetVersionIdFun001,
Function | MediumTest | Level1) {
const char* value = GetVersionId();
printf("Version Id=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetVersionIdFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3200
* @tc.desc : test obtaining device info VersionId that less than 127
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetVersionIdFun002,
Function | MediumTest | Level1) {
const char* value = GetVersionId();
printf("Version Id=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 127);
}
};
/**
* @tc.name : testGetBuildTypeFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3300
* @tc.desc : test obtaining device info BuildType is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetBuildTypeFun001,
Function | MediumTest | Level1) {
const char* value = GetBuildType();
printf("Build Type=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetBuildTypeFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3400
* @tc.desc : test obtaining device info BuildType that less than 32
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetBuildTypeFun002,
Function | MediumTest | Level1) {
const char* value = GetBuildType();
printf("Build Type=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 32);
}
};
/**
* @tc.name : testGetBuildUserFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3500
* @tc.desc : test obtaining device info BuildUser is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetBuildUserFun001,
Function | MediumTest | Level1) {
const char* value = GetBuildUser();
printf("Build User=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetBuildUserFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3600
* @tc.desc : test obtaining device info BuildUser that less than 32
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetBuildUserFun002,
Function | MediumTest | Level1) {
const char* value = GetBuildUser();
printf("Build User=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 32);
}
};
/**
* @tc.name : testGetBuildHostFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3700
* @tc.desc : test obtaining device info BuildHost is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetBuildHostFun001,
Function | MediumTest | Level1) {
const char* value = GetBuildHost();
printf("Build Host=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetBuildHostFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3800
* @tc.desc : test obtaining device info BuildHost that less than 32
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetBuildHostFun002,
Function | MediumTest | Level1) {
const char* value = GetBuildHost();
printf("Build Host=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 32);
}
};
/**
* @tc.name : testGetBuildTimeFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3900
* @tc.desc : test obtaining device info BuildTime is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetBuildTimeFun001,
Function | MediumTest | Level1) {
const char* value = GetBuildTime();
printf("Build Time=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetBuildTimeFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_4000
* @tc.desc : test obtaining device info BuildTime that less than 32
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetBuildTimeFun002,
Function | MediumTest | Level1) {
const char* value = GetBuildTime();
printf("Build Time=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 32);
}
};
/**
* @tc.name : testGetSoftwareModelFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_4100
* @tc.desc : test obtaining device info SoftwareModel is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetSoftwareModelFun001,
Function | MediumTest | Level1) {
const char* value = GetSoftwareModel();
printf("Software Model=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.name : testGetSoftwareModelFun002
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_4200
* @tc.desc : test obtaining device info SoftwareModel that less than 32
* characters.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetSoftwareModelFun002,
Function | MediumTest | Level1) {
const char* value = GetSoftwareModel();
printf("Software Model=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
if (value != NULL) {
TEST_ASSERT_TRUE(strlen(value) <= 32);
}
};
/**
* @tc.name : testGetBuildRootHashFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_4500
* @tc.desc : test obtaining device info BuildRootHash is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetBuildRootHashFun001,
Function | MediumTest | Level1) {
const char* value = GetBuildRootHash();
printf("Build Root Hash=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
};
/**
* @tc.name : testGetHardwareProfileFun001
* @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_4600
* @tc.desc : test obtaining device info HardwareProfile is not null.
*/
LITE_TEST_CASE(DeviceInfoFuncTestSuite,
testGetHardwareProfileFun001,
Function | MediumTest | Level1) {
const char* value = GetHardwareProfile();
printf("Hardware Profile=%s\n", value);
AssertNotEmpty(value);
};
RUN_TEST_SUITE(DeviceInfoFuncTestSuite);
...@@ -13,21 +13,22 @@ ...@@ -13,21 +13,22 @@
* limitations under the License. * limitations under the License.
*/ */
#include "ohos_types.h"
#include <securec.h> #include <securec.h>
#include "hctest.h" #include "hctest.h"
#include "ohos_types.h"
#include "parameter.h" #include "parameter.h"
#include "parameter_utils.h" #include "parameter_utils.h"
#define MAX_LEN 128 #define MAX_LEN 128
#define INVALID_LEN 2 #define INVALID_LEN 2
#define COMMON_ERROR (-1) #define COMMON_ERROR (-1)
#define INVALID_PARAMETER (-9) #define INVALID_PARAMETER (-9)
static const char* g_defSysParam = "data of sys param ***..."; static const char* g_defSysParam = "data of sys param ***...";
/** /**
* @tc.desc : register a test suite, this suite is used to test basic flow and interface dependency * @tc.desc : register a test suite, this suite is used to test basic flow
* and interface dependency
* @param : subsystem name is utils * @param : subsystem name is utils
* @param : module name is parameter * @param : module name is parameter
* @param : test suit name is ParameterFuncTestSuite * @param : test suit name is ParameterFuncTestSuite
...@@ -38,8 +39,7 @@ LITE_TEST_SUIT(utils, parameter, ParameterFuncTestSuite); ...@@ -38,8 +39,7 @@ LITE_TEST_SUIT(utils, parameter, ParameterFuncTestSuite);
* @tc.setup : setup for all testcases * @tc.setup : setup for all testcases
* @return : setup result, TRUE is success, FALSE is fail * @return : setup result, TRUE is success, FALSE is fail
*/ */
static BOOL ParameterFuncTestSuiteSetUp(void) static BOOL ParameterFuncTestSuiteSetUp(void) {
{
return TRUE; return TRUE;
} }
...@@ -47,324 +47,19 @@ static BOOL ParameterFuncTestSuiteSetUp(void) ...@@ -47,324 +47,19 @@ static BOOL ParameterFuncTestSuiteSetUp(void)
* @tc.teardown : teardown for all testcases * @tc.teardown : teardown for all testcases
* @return : teardown result, TRUE is success, FALSE is fail * @return : teardown result, TRUE is success, FALSE is fail
*/ */
static BOOL ParameterFuncTestSuiteTearDown(void) static BOOL ParameterFuncTestSuiteTearDown(void) {
{
printf("+-------------------------------------------+\n"); printf("+-------------------------------------------+\n");
return TRUE; return TRUE;
} }
/**
* @tc.number : SUB_UTILS_PARAMETER_0100
* @tc.name : Obtaining system parameter DeviceType
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara001, Function | MediumTest | Level1)
{
const char* value = GetDeviceType();
printf("Device Type=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_0200
* @tc.name : Obtaining system parameter Manufacture
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara002, Function | MediumTest | Level1)
{
const char* value = GetManufacture();
printf("Manufacture=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_0300
* @tc.name : Obtaining system parameter Brand
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara003, Function | MediumTest | Level1)
{
const char* value = GetBrand();
printf("Brand=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_0400
* @tc.name : Obtaining system parameter MarketName
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara004, Function | MediumTest | Level1)
{
const char* value = GetMarketName();
printf("Market Name=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_0500
* @tc.name : Obtaining system parameter ProductSeries
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara005, Function | MediumTest | Level1)
{
const char* value = GetProductSeries();
printf("Product Series=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_0600
* @tc.name : Obtaining system parameter ProductModel
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara006, Function | MediumTest | Level1)
{
const char* value = GetProductModel();
printf("Product Model=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_0700
* @tc.name : Obtaining system parameter HardwareModel
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara007, Function | MediumTest | Level1)
{
const char* value = GetHardwareModel();
printf("Hardware Model=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_0800
* @tc.name : Obtaining system parameter HardwareProfile
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara008, Function | MediumTest | Level1)
{
const char* value = GetHardwareProfile();
printf("Hardware Profile=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_0900
* @tc.name : Obtaining system parameter Serial
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara009, Function | MediumTest | Level1)
{
const char* value = GetSerial();
printf("Serial=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_1000
* @tc.name : Obtaining system parameter OsName
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara010, Function | MediumTest | Level1)
{
const char* value = GetOSFullName();
printf("Os Name=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_1100
* @tc.name : Obtaining system parameter DisplayVersion
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara011, Function | MediumTest | Level1)
{
const char* value = GetDisplayVersion();
printf("Display Version=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_1200
* @tc.name : Obtaining system parameter BootloaderVersion
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara012, Function | MediumTest | Level1)
{
const char* value = GetBootloaderVersion();
printf("Bootloader Version=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_1300
* @tc.name : Obtaining system parameter SecurityPatchTag
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara013, Function | MediumTest | Level1)
{
const char* value = GetSecurityPatchTag();
printf("Secure Patch Level=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_8200
* @tc.name : Obtaining system parameter SecurityPatchTag which format is yy--mm--dd
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetSecurityPatchTag02, Function | MediumTest | Level1)
{
const char *value = GetSecurityPatchTag();
printf("Secure Patch Level=%s\n", value);
int year, month, day;
sscanf(value, "%04d-%02d-%02d", &year, &month, &day);
printf("%d-%02d-%02d\n", year, month, day);
char *str = ("%d-%02d-%02d\n", year, month, day);
TEST_ONLY();
};
/**
* @tc.number : SUB_UTILS_PARAMETER_1400
* @tc.name : Obtaining system parameter AbiList
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara014, Function | MediumTest | Level1)
{
const char* value = GetAbiList();
printf("Abi List=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_1500
* @tc.name : Obtaining system parameter FirstApiLevel
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara015, Function | MediumTest | Level1)
{
int value = GetFirstApiVersion();
printf("First Api Level=%d\n", value);
TEST_ASSERT_TRUE(value > 0);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_1600
* @tc.name : Obtaining system parameter IncrementalVersion
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara016, Function | MediumTest | Level1)
{
const char* value = GetIncrementalVersion();
printf("Incremental Version=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_1700
* @tc.name : Obtaining system parameter VersionId
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara017, Function | MediumTest | Level1)
{
const char* value = GetVersionId();
printf("Version Id=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_1800
* @tc.name : Obtaining system parameter BuildType
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara018, Function | MediumTest | Level1)
{
const char* value = GetBuildType();
printf("Build Type=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_1900
* @tc.name : Obtaining system parameter BuildUser
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara019, Function | MediumTest | Level1)
{
const char* value = GetBuildUser();
printf("Build User=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_2000
* @tc.name : Obtaining system parameter BuildHost
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara020, Function | MediumTest | Level1)
{
const char* value = GetBuildHost();
printf("Build Host=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_2100
* @tc.name : Obtaining system parameter BuildTime
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara021, Function | MediumTest | Level1)
{
const char* value = GetBuildTime();
printf("Build Time=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_2200
* @tc.name : Obtaining system parameter BuildRootHash
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara022, Function | MediumTest | Level1)
{
const char* value = GetBuildRootHash();
printf("Build Root Hash=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_2300
* @tc.name : Obtaining system parameter SoftwareModel
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara023, Function | MediumTest | Level1)
{
const char* value = GetSoftwareModel();
printf("Software Model=%s\n", value);
AssertNotEmpty(value);
};
/**
* @tc.number : SUB_UTILS_PARAMETER_2400
* @tc.name : Obtaining system parameter SdkApiLevel
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara024, Function | MediumTest | Level1)
{
int value = GetSdkApiVersion();
printf("Sdk Api Level=%d\n", value);
TEST_ASSERT_TRUE(value > 0);
};
/** /**
* @tc.number : SUB_UTILS_PARAMETER_2500 * @tc.number : SUB_UTILS_PARAMETER_2500
* @tc.name : SetParameter parameter legal test * @tc.name : SetParameter parameter legal test
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter001, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testSetParameter001,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "rw.sys.version_606"; char key[] = "rw.sys.version_606";
...@@ -378,8 +73,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter001, Function | MediumTes ...@@ -378,8 +73,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter001, Function | MediumTes
* @tc.name : SetParameter parameter legal test with Special characters * @tc.name : SetParameter parameter legal test with Special characters
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter002, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testSetParameter002,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "_._..__...___"; char key[] = "_._..__...___";
...@@ -390,11 +86,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter002, Function | MediumTes ...@@ -390,11 +86,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter002, Function | MediumTes
/** /**
* @tc.number : SUB_UTILS_PARAMETER_2700 * @tc.number : SUB_UTILS_PARAMETER_2700
* @tc.name : SetParameter parameter legal test using key with only lowercase * @tc.name : SetParameter parameter legal test using key with only
* lowercase
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter003, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testSetParameter003,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "keywithonlylowercase"; char key[] = "keywithonlylowercase";
...@@ -408,8 +106,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter003, Function | MediumTes ...@@ -408,8 +106,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter003, Function | MediumTes
* @tc.name : SetParameter parameter legal test using key with only number * @tc.name : SetParameter parameter legal test using key with only number
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter004, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testSetParameter004,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "202006060602"; char key[] = "202006060602";
...@@ -420,11 +119,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter004, Function | MediumTes ...@@ -420,11 +119,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter004, Function | MediumTes
/** /**
* @tc.number : SUB_UTILS_PARAMETER_2900 * @tc.number : SUB_UTILS_PARAMETER_2900
* @tc.name : SetParameter parameter legal test using key and value with maximum length * @tc.name : SetParameter parameter legal test using key and value with
* maximum length
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter005, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testSetParameter005,
Function | MediumTest | Level1) {
int ret; int ret;
char key1[] = "rw.sys.version.version.version."; char key1[] = "rw.sys.version.version.version.";
...@@ -433,7 +134,8 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter005, Function | MediumTes ...@@ -433,7 +134,8 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter005, Function | MediumTes
TEST_ASSERT_EQUAL_INT(0, ret); TEST_ASSERT_EQUAL_INT(0, ret);
char key2[] = "rw.sys.version.version"; char key2[] = "rw.sys.version.version";
char value2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\ char value2[] =
"abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs"; abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs";
ret = SetParameter(key2, value2); ret = SetParameter(key2, value2);
TEST_ASSERT_EQUAL_INT(0, ret); TEST_ASSERT_EQUAL_INT(0, ret);
...@@ -441,74 +143,74 @@ abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs"; ...@@ -441,74 +143,74 @@ abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs";
/** /**
* @tc.number : SUB_UTILS_PARAMETER_3000 * @tc.number : SUB_UTILS_PARAMETER_3000
* @tc.name : SetParameter parameter illegal test when key is nullptr and value is nullptr * @tc.name : SetParameter parameter illegal test when key is nullptr and
* value is nullptr
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter006, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testSetParameter006,
Function | MediumTest | Level1) {
int ret; int ret;
char value[] = "test with null"; char value[] = "test with null";
ret = SetParameter(NULL, value); ret = SetParameter(NULL, value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
char key[] = "rw.sys.version"; char key[] = "rw.sys.version";
ret = SetParameter(key, NULL); ret = SetParameter(key, NULL);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
/** /**
* @tc.number : SUB_UTILS_PARAMETER_3100 * @tc.number : SUB_UTILS_PARAMETER_3100
* @tc.name : SetParameter parameter illegal test when key is NULL and value is NULL * @tc.name : SetParameter parameter illegal test when key is NULL and
* value is NULL
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter007, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testSetParameter007,
Function | MediumTest | Level1) {
int ret; int ret;
char value[] = "test with null"; char value[] = "test with null";
ret = SetParameter("\0", value); ret = SetParameter("\0", value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
char key[] = "rw.sys.version"; char key[] = "rw.sys.version";
ret = SetParameter(key, "\0"); ret = SetParameter(key, "\0");
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
/** /**
* @tc.number : SUB_UTILS_PARAMETER_3200 * @tc.number : SUB_UTILS_PARAMETER_3200
* @tc.name : SetParameter parameter illegal test when key len is 32 or more than 32 bytes * @tc.name : SetParameter parameter illegal test when key len is 32 or
* more than 32 bytes
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter008, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testSetParameter008,
Function | MediumTest | Level1) {
int ret; int ret;
char key1[] = "rw.sys.version.version.version.v"; char key1[] = "rw.sys.version.version.version.v";
char value1[] = "set with key = 32"; char value1[] = "set with key = 32";
ret = SetParameter(key1, value1); ret = SetParameter(key1, value1);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
char key2[] = "rw.sys.version.version.version.version"; char key2[] = "rw.sys.version.version.version.version";
char value2[] = "set with key > 32"; char value2[] = "set with key > 32";
ret = SetParameter(key2, value2); ret = SetParameter(key2, value2);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
...@@ -518,15 +220,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter008, Function | MediumTes ...@@ -518,15 +220,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter008, Function | MediumTes
* @tc.name : SetParameter parameter illegal test using key with uppercase * @tc.name : SetParameter parameter illegal test using key with uppercase
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter009, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testSetParameter009,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "Rw.Sys.Version.Version"; char key[] = "Rw.Sys.Version.Version";
char value[] = "set value with uppercase"; char value[] = "set value with uppercase";
ret = SetParameter(key, value); ret = SetParameter(key, value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
...@@ -536,72 +238,77 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter009, Function | MediumTes ...@@ -536,72 +238,77 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter009, Function | MediumTes
* @tc.name : SetParameter parameter illegal test using key with blank * @tc.name : SetParameter parameter illegal test using key with blank
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter010, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testSetParameter010,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "rw sys version version"; char key[] = "rw sys version version";
char value[] = "set value with blank"; char value[] = "set value with blank";
ret = SetParameter(key, value); ret = SetParameter(key, value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
/** /**
* @tc.number : SUB_UTILS_PARAMETER_3500 * @tc.number : SUB_UTILS_PARAMETER_3500
* @tc.name : SetParameter parameter illegal test using key with invalid special characters * @tc.name : SetParameter parameter illegal test using key with invalid
* special characters
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter011, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testSetParameter011,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "rw+sys&version%version*"; char key[] = "rw+sys&version%version*";
char value[] = "set value with special characters"; char value[] = "set value with special characters";
ret = SetParameter(key, value); ret = SetParameter(key, value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
/** /**
* @tc.number : SUB_UTILS_PARAMETER_3600 * @tc.number : SUB_UTILS_PARAMETER_3600
* @tc.name : SetParameter parameter illegal test when value length is 128 or more than 128 bytes * @tc.name : SetParameter parameter illegal test when value length is 128
* or more than 128 bytes
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter012, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testSetParameter012,
Function | MediumTest | Level1) {
int ret; int ret;
char key1[] = "rw.sys.version.version1"; char key1[] = "rw.sys.version.version1";
char value1[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\ char value1[] =
"abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrst"; abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrst";
ret = SetParameter(key1, value1); ret = SetParameter(key1, value1);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
char key2[] = "rw.sys.version.version2"; char key2[] = "rw.sys.version.version2";
char value2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\ char value2[] =
"abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890"; abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890";
ret = SetParameter(key2, value2); ret = SetParameter(key2, value2);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
/** /**
* @tc.number : SUB_UTILS_PARAMETER_3700 * @tc.number : SUB_UTILS_PARAMETER_3700
* @tc.name : SetParameter parameter legal test when value contains only blanks * @tc.name : SetParameter parameter legal test when value contains only
* blanks
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter013, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testSetParameter013,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "key_for_blank_value"; char key[] = "key_for_blank_value";
...@@ -615,8 +322,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter013, Function | MediumTes ...@@ -615,8 +322,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter013, Function | MediumTes
* @tc.name : GetParameter parameter legal test * @tc.name : GetParameter parameter legal test
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter001, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter001,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "rw.sys.version_606"; char key[] = "rw.sys.version_606";
...@@ -633,8 +341,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter001, Function | MediumTes ...@@ -633,8 +341,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter001, Function | MediumTes
* @tc.name : GetParameter parameter legal test with Special characters * @tc.name : GetParameter parameter legal test with Special characters
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter002, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter002,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "_._..__...___"; char key[] = "_._..__...___";
...@@ -648,11 +357,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter002, Function | MediumTes ...@@ -648,11 +357,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter002, Function | MediumTes
/** /**
* @tc.number : SUB_UTILS_PARAMETER_4000 * @tc.number : SUB_UTILS_PARAMETER_4000
* @tc.name : GetParameter parameter legal test using key with only lowercase * @tc.name : GetParameter parameter legal test using key with only
* lowercase
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter003, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter003,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "keywithonlylowercase"; char key[] = "keywithonlylowercase";
...@@ -669,8 +380,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter003, Function | MediumTes ...@@ -669,8 +380,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter003, Function | MediumTes
* @tc.name : GetParameter parameter legal test using key with only number * @tc.name : GetParameter parameter legal test using key with only number
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter004, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter004,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "202006060602"; char key[] = "202006060602";
...@@ -684,11 +396,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter004, Function | MediumTes ...@@ -684,11 +396,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter004, Function | MediumTes
/** /**
* @tc.number : SUB_UTILS_PARAMETER_4200 * @tc.number : SUB_UTILS_PARAMETER_4200
* @tc.name : GetParameter parameter legal test when defaut value point is nullptr * @tc.name : GetParameter parameter legal test when defaut value point is
* nullptr
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter005, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter005,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "rw.sys.version_606"; char key[] = "rw.sys.version_606";
...@@ -705,8 +419,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter005, Function | MediumTes ...@@ -705,8 +419,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter005, Function | MediumTes
* @tc.name : GetParameter parameter legal test when the key is not exist * @tc.name : GetParameter parameter legal test when the key is not exist
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter006, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter006,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "none.exist.key"; char key[] = "none.exist.key";
...@@ -718,11 +433,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter006, Function | MediumTes ...@@ -718,11 +433,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter006, Function | MediumTes
/** /**
* @tc.number : SUB_UTILS_PARAMETER_4400 * @tc.number : SUB_UTILS_PARAMETER_4400
* @tc.name : GetParameter parameter legal test using key and value with maximum length * @tc.name : GetParameter parameter legal test using key and value with
* maximum length
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter007, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter007,
Function | MediumTest | Level1) {
int ret; int ret;
char key1[] = "rw.sys.version.version.version."; char key1[] = "rw.sys.version.version.version.";
...@@ -734,7 +451,8 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter007, Function | MediumTes ...@@ -734,7 +451,8 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter007, Function | MediumTes
TEST_ASSERT_EQUAL_STRING(rightVal1, value1); TEST_ASSERT_EQUAL_STRING(rightVal1, value1);
char key2[] = "rw.sys.version.version"; char key2[] = "rw.sys.version.version";
char rightVal2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\ char rightVal2[] =
"abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs"; abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs";
char value2[MAX_LEN] = {0}; char value2[MAX_LEN] = {0};
SetParameter(key2, rightVal2); SetParameter(key2, rightVal2);
...@@ -748,8 +466,9 @@ abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs"; ...@@ -748,8 +466,9 @@ abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs";
* @tc.name : GetParameter parameter illegal test with invalid value length * @tc.name : GetParameter parameter illegal test with invalid value length
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter008, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter008,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "rw.sys.version_606"; char key[] = "rw.sys.version_606";
...@@ -757,38 +476,40 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter008, Function | MediumTes ...@@ -757,38 +476,40 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter008, Function | MediumTes
char value[INVALID_LEN] = {0}; char value[INVALID_LEN] = {0};
SetParameter(key, rightVal); SetParameter(key, rightVal);
ret = GetParameter(key, g_defSysParam, value, INVALID_LEN); ret = GetParameter(key, g_defSysParam, value, INVALID_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
/** /**
* @tc.number : SUB_UTILS_PARAMETER_4600 * @tc.number : SUB_UTILS_PARAMETER_4600
* @tc.name : GetParameter parameter illegal test when value point is nullptr * @tc.name : GetParameter parameter illegal test when value point is
* nullptr
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter009, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter009,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "rw.sys.version_606"; char key[] = "rw.sys.version_606";
char rightVal[] = "OEM-10.1.0"; char rightVal[] = "OEM-10.1.0";
SetParameter(key, rightVal); SetParameter(key, rightVal);
ret = GetParameter(key, g_defSysParam, NULL, MAX_LEN); ret = GetParameter(key, g_defSysParam, NULL, MAX_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
/** /**
* @tc.number : SUB_UTILS_PARAMETER_4700 * @tc.number : SUB_UTILS_PARAMETER_4700
* @tc.name : GetParameter parameter illegal test when key is not exist and value len is invalid * @tc.name : GetParameter parameter illegal test when key is not exist and
* value len is invalid
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter010, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter010,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "none.exist.key"; char key[] = "none.exist.key";
...@@ -799,11 +520,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter010, Function | MediumTes ...@@ -799,11 +520,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter010, Function | MediumTes
/** /**
* @tc.number : SUB_UTILS_PARAMETER_4800 * @tc.number : SUB_UTILS_PARAMETER_4800
* @tc.name : GetParameter parameter illegal test when key is not exist and defaut value point is nullptr * @tc.name : GetParameter parameter illegal test when key is not exist and
* defaut value point is nullptr
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter011, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter011,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "none.exist.key"; char key[] = "none.exist.key";
...@@ -817,33 +540,34 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter011, Function | MediumTes ...@@ -817,33 +540,34 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter011, Function | MediumTes
* @tc.name : GetParameter parameter illegal test when key len is 32 bytes * @tc.name : GetParameter parameter illegal test when key len is 32 bytes
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter012, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter012,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "rw.sys.version.version.version.v"; char key[] = "rw.sys.version.version.version.v";
char value[MAX_LEN] = {0}; char value[MAX_LEN] = {0};
ret = GetParameter(key, g_defSysParam, value, MAX_LEN); ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
/** /**
* @tc.number : SUB_UTILS_PARAMETER_5000 * @tc.number : SUB_UTILS_PARAMETER_5000
* @tc.name : GetParameter parameter illegal test when key len is more than 32 bytes * @tc.name : GetParameter parameter illegal test when key len is more than
* 32 bytes
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter013, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter013,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "rw.sys.version.version.version.version"; char key[] = "rw.sys.version.version.version.version";
char value[MAX_LEN] = {0}; char value[MAX_LEN] = {0};
ret = GetParameter(key, g_defSysParam, value, MAX_LEN); ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
...@@ -853,14 +577,14 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter013, Function | MediumTes ...@@ -853,14 +577,14 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter013, Function | MediumTes
* @tc.name : GetParameter parameter illegal test when key is nullptr * @tc.name : GetParameter parameter illegal test when key is nullptr
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter014, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter014,
Function | MediumTest | Level1) {
int ret; int ret;
char value[MAX_LEN] = {0}; char value[MAX_LEN] = {0};
ret = GetParameter(NULL, g_defSysParam, value, MAX_LEN); ret = GetParameter(NULL, g_defSysParam, value, MAX_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
...@@ -870,15 +594,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter014, Function | MediumTes ...@@ -870,15 +594,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter014, Function | MediumTes
* @tc.name : GetParameter parameter illegal test using key with uppercase * @tc.name : GetParameter parameter illegal test using key with uppercase
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter015, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter015,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "Rw.Sys.Version.Version"; char key[] = "Rw.Sys.Version.Version";
char value[MAX_LEN] = {0}; char value[MAX_LEN] = {0};
ret = GetParameter(key, g_defSysParam, value, MAX_LEN); ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
...@@ -888,33 +612,34 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter015, Function | MediumTes ...@@ -888,33 +612,34 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter015, Function | MediumTes
* @tc.name : GetParameter parameter illegal test using key with blank * @tc.name : GetParameter parameter illegal test using key with blank
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter016, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter016,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "rw sys version version"; char key[] = "rw sys version version";
char value[MAX_LEN] = {0}; char value[MAX_LEN] = {0};
ret = GetParameter(key, g_defSysParam, value, MAX_LEN); ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
/** /**
* @tc.number : SUB_UTILS_PARAMETER_5400 * @tc.number : SUB_UTILS_PARAMETER_5400
* @tc.name : GetParameter parameter illegal test using key with invalid special characters * @tc.name : GetParameter parameter illegal test using key with invalid
* special characters
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter017, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter017,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "rw+sys&version%version*"; char key[] = "rw+sys&version%version*";
char value[MAX_LEN] = {0}; char value[MAX_LEN] = {0};
ret = GetParameter(key, g_defSysParam, value, MAX_LEN); ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
...@@ -924,25 +649,27 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter017, Function | MediumTes ...@@ -924,25 +649,27 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter017, Function | MediumTes
* @tc.name : GetParameter parameter illegal test when key is NULL * @tc.name : GetParameter parameter illegal test when key is NULL
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter018, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter018,
Function | MediumTest | Level1) {
int ret; int ret;
char value[MAX_LEN] = {0}; char value[MAX_LEN] = {0};
ret = GetParameter("\0", g_defSysParam, value, MAX_LEN); ret = GetParameter("\0", g_defSysParam, value, MAX_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
{
TEST_ASSERT_EQUAL_INT(1, 1); TEST_ASSERT_EQUAL_INT(1, 1);
} }
}; };
/** /**
* @tc.number : SUB_UTILS_PARAMETER_5600 * @tc.number : SUB_UTILS_PARAMETER_5600
* @tc.name : GetParameter parameter legal test when value contains only blanks * @tc.name : GetParameter parameter legal test when value contains only
* blanks
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter019, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter019,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "key_for_blank_value"; char key[] = "key_for_blank_value";
...@@ -959,8 +686,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter019, Function | MediumTes ...@@ -959,8 +686,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter019, Function | MediumTes
* @tc.name : Update value of parameter legal test * @tc.name : Update value of parameter legal test
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter020, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterFuncTestSuite,
{ testGetParameter020,
Function | MediumTest | Level1) {
int ret; int ret;
char key[] = "rw.sys.version_606"; char key[] = "rw.sys.version_606";
......
...@@ -13,16 +13,17 @@ ...@@ -13,16 +13,17 @@
* limitations under the License. * limitations under the License.
*/ */
#include "ohos_types.h"
#include <securec.h> #include <securec.h>
#include "hctest.h" #include "hctest.h"
#include "ohos_types.h"
#include "parameter.h" #include "parameter.h"
#include "parameter_utils.h" #include "parameter_utils.h"
#define QUERY_TIMES 50 #define QUERY_TIMES 50
/** /**
* @tc.desc : register a test suite, this suite is used to test basic flow and interface dependency * @tc.desc : register a test suite, this suite is used to test basic flow
* and interface dependency
* @param : subsystem name is utils * @param : subsystem name is utils
* @param : module name is parameter * @param : module name is parameter
* @param : test suit name is ParameterReliTestSuite * @param : test suit name is ParameterReliTestSuite
...@@ -33,8 +34,7 @@ LITE_TEST_SUIT(utils, parameter, ParameterReliTestSuite); ...@@ -33,8 +34,7 @@ LITE_TEST_SUIT(utils, parameter, ParameterReliTestSuite);
* @tc.setup : setup for all testcases * @tc.setup : setup for all testcases
* @return : setup result, TRUE is success, FALSE is fail * @return : setup result, TRUE is success, FALSE is fail
*/ */
static BOOL ParameterReliTestSuiteSetUp(void) static BOOL ParameterReliTestSuiteSetUp(void) {
{
return TRUE; return TRUE;
} }
...@@ -42,8 +42,7 @@ static BOOL ParameterReliTestSuiteSetUp(void) ...@@ -42,8 +42,7 @@ static BOOL ParameterReliTestSuiteSetUp(void)
* @tc.teardown : teardown for all testcases * @tc.teardown : teardown for all testcases
* @return : teardown result, TRUE is success, FALSE is fail * @return : teardown result, TRUE is success, FALSE is fail
*/ */
static BOOL ParameterReliTestSuiteTearDown(void) static BOOL ParameterReliTestSuiteTearDown(void) {
{
printf("+-------------------------------------------+\n"); printf("+-------------------------------------------+\n");
return TRUE; return TRUE;
} }
...@@ -53,13 +52,13 @@ static BOOL ParameterReliTestSuiteTearDown(void) ...@@ -53,13 +52,13 @@ static BOOL ParameterReliTestSuiteTearDown(void)
* @tc.name : Obtaining ProductType for multiple times * @tc.name : Obtaining ProductType for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli001, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli001,
Function | MediumTest | Level1) {
const char* value1 = GetDeviceType(); const char* value1 = GetDeviceType();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetDeviceType();
const char* value = GetDeviceType();
} }
const char* value2 = GetDeviceType(); const char* value2 = GetDeviceType();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -70,13 +69,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli001, Function | Medi ...@@ -70,13 +69,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli001, Function | Medi
* @tc.name : Obtaining Manufacture for multiple times * @tc.name : Obtaining Manufacture for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli002, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli002,
Function | MediumTest | Level1) {
const char* value1 = GetManufacture(); const char* value1 = GetManufacture();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetManufacture();
const char* value = GetManufacture();
} }
const char* value2 = GetManufacture(); const char* value2 = GetManufacture();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -87,13 +86,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli002, Function | Medi ...@@ -87,13 +86,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli002, Function | Medi
* @tc.name : Obtaining Brand for multiple times * @tc.name : Obtaining Brand for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli003, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli003,
Function | MediumTest | Level1) {
const char* value1 = GetBrand(); const char* value1 = GetBrand();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetBrand();
const char* value = GetBrand();
} }
const char* value2 = GetBrand(); const char* value2 = GetBrand();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -104,13 +103,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli003, Function | Medi ...@@ -104,13 +103,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli003, Function | Medi
* @tc.name : Obtaining MarketName for multiple times * @tc.name : Obtaining MarketName for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli004, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli004,
Function | MediumTest | Level1) {
const char* value1 = GetMarketName(); const char* value1 = GetMarketName();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetMarketName();
const char* value = GetMarketName();
} }
const char* value2 = GetMarketName(); const char* value2 = GetMarketName();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -121,13 +120,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli004, Function | Medi ...@@ -121,13 +120,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli004, Function | Medi
* @tc.name : Obtaining ProductSeries for multiple times * @tc.name : Obtaining ProductSeries for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli005, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli005,
Function | MediumTest | Level1) {
const char* value1 = GetProductSeries(); const char* value1 = GetProductSeries();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetProductSeries();
const char* value = GetProductSeries();
} }
const char* value2 = GetProductSeries(); const char* value2 = GetProductSeries();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -138,13 +137,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli005, Function | Medi ...@@ -138,13 +137,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli005, Function | Medi
* @tc.name : Obtaining ProductModel for multiple times * @tc.name : Obtaining ProductModel for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli006, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli006,
Function | MediumTest | Level1) {
const char* value1 = GetProductModel(); const char* value1 = GetProductModel();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetProductModel();
const char* value = GetProductModel();
} }
const char* value2 = GetProductModel(); const char* value2 = GetProductModel();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -155,13 +154,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli006, Function | Medi ...@@ -155,13 +154,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli006, Function | Medi
* @tc.name : Obtaining HardwareModel for multiple times * @tc.name : Obtaining HardwareModel for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli007, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli007,
Function | MediumTest | Level1) {
const char* value1 = GetHardwareModel(); const char* value1 = GetHardwareModel();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetHardwareModel();
const char* value = GetHardwareModel();
} }
const char* value2 = GetHardwareModel(); const char* value2 = GetHardwareModel();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -172,13 +171,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli007, Function | Medi ...@@ -172,13 +171,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli007, Function | Medi
* @tc.name : Obtaining HardwareProfile for multiple times * @tc.name : Obtaining HardwareProfile for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli008, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli008,
Function | MediumTest | Level1) {
const char* value1 = GetHardwareProfile(); const char* value1 = GetHardwareProfile();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetHardwareProfile();
const char* value = GetHardwareProfile();
} }
const char* value2 = GetHardwareProfile(); const char* value2 = GetHardwareProfile();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -189,16 +188,16 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli008, Function | Medi ...@@ -189,16 +188,16 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli008, Function | Medi
* @tc.name : Obtaining Serial for multiple times * @tc.name : Obtaining Serial for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli009, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli009,
Function | MediumTest | Level1) {
const char* value1 = GetSerial(); const char* value1 = GetSerial();
if (value1 == NULL) { if (value1 == NULL) {
printf("The serial number needs to be written\n"); printf("The serial number needs to be written\n");
TEST_IGNORE(); TEST_IGNORE();
} }
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetSerial();
const char* value = GetSerial();
} }
const char* value2 = GetSerial(); const char* value2 = GetSerial();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -209,13 +208,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli009, Function | Medi ...@@ -209,13 +208,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli009, Function | Medi
* @tc.name : Obtaining OsName for multiple times * @tc.name : Obtaining OsName for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli010, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli010,
Function | MediumTest | Level1) {
const char* value1 = GetOSFullName(); const char* value1 = GetOSFullName();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetOSFullName();
const char* value = GetOSFullName();
} }
const char* value2 = GetOSFullName(); const char* value2 = GetOSFullName();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -226,13 +225,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli010, Function | Medi ...@@ -226,13 +225,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli010, Function | Medi
* @tc.name : Obtaining DisplayVersion for multiple times * @tc.name : Obtaining DisplayVersion for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli011, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli011,
Function | MediumTest | Level1) {
const char* value1 = GetDisplayVersion(); const char* value1 = GetDisplayVersion();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetDisplayVersion();
const char* value = GetDisplayVersion();
} }
const char* value2 = GetDisplayVersion(); const char* value2 = GetDisplayVersion();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -243,13 +242,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli011, Function | Medi ...@@ -243,13 +242,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli011, Function | Medi
* @tc.name : Obtaining BootloaderVersion for multiple times * @tc.name : Obtaining BootloaderVersion for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli012, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli012,
Function | MediumTest | Level1) {
const char* value1 = GetBootloaderVersion(); const char* value1 = GetBootloaderVersion();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetBootloaderVersion();
const char* value = GetBootloaderVersion();
} }
const char* value2 = GetBootloaderVersion(); const char* value2 = GetBootloaderVersion();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -260,13 +259,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli012, Function | Medi ...@@ -260,13 +259,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli012, Function | Medi
* @tc.name : Obtaining SecurityPatchTag for multiple times * @tc.name : Obtaining SecurityPatchTag for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli013, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli013,
Function | MediumTest | Level1) {
const char* value1 = GetSecurityPatchTag(); const char* value1 = GetSecurityPatchTag();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetSecurityPatchTag();
const char* value = GetSecurityPatchTag();
} }
const char* value2 = GetSecurityPatchTag(); const char* value2 = GetSecurityPatchTag();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -277,13 +276,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli013, Function | Medi ...@@ -277,13 +276,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli013, Function | Medi
* @tc.name : Obtaining AbiList for multiple times * @tc.name : Obtaining AbiList for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli014, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli014,
Function | MediumTest | Level1) {
const char* value1 = GetAbiList(); const char* value1 = GetAbiList();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetAbiList();
const char* value = GetAbiList();
} }
const char* value2 = GetAbiList(); const char* value2 = GetAbiList();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -294,14 +293,14 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli014, Function | Medi ...@@ -294,14 +293,14 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli014, Function | Medi
* @tc.name : Obtaining FirstApiLevel for multiple times * @tc.name : Obtaining FirstApiLevel for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli015, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli015,
Function | MediumTest | Level1) {
int value1 = GetFirstApiVersion(); int value1 = GetFirstApiVersion();
TEST_ASSERT_NOT_NULL(value1); TEST_ASSERT_NOT_NULL(value1);
TEST_ASSERT_TRUE((int)value1 == value1); TEST_ASSERT_TRUE((int)value1 == value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ int value = GetFirstApiVersion();
int value = GetFirstApiVersion();
} }
int value2 = GetFirstApiVersion(); int value2 = GetFirstApiVersion();
TEST_ASSERT_EQUAL_INT(value1, value2); TEST_ASSERT_EQUAL_INT(value1, value2);
...@@ -312,13 +311,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli015, Function | Medi ...@@ -312,13 +311,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli015, Function | Medi
* @tc.name : Obtaining IncrementalVersion for multiple times * @tc.name : Obtaining IncrementalVersion for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli016, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli016,
Function | MediumTest | Level1) {
const char* value1 = GetIncrementalVersion(); const char* value1 = GetIncrementalVersion();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetIncrementalVersion();
const char* value = GetIncrementalVersion();
} }
const char* value2 = GetIncrementalVersion(); const char* value2 = GetIncrementalVersion();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -329,13 +328,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli016, Function | Medi ...@@ -329,13 +328,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli016, Function | Medi
* @tc.name : Obtaining VersionId for multiple times * @tc.name : Obtaining VersionId for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli017, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli017,
Function | MediumTest | Level1) {
const char* value1 = GetVersionId(); const char* value1 = GetVersionId();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetVersionId();
const char* value = GetVersionId();
} }
const char* value2 = GetVersionId(); const char* value2 = GetVersionId();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -346,13 +345,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli017, Function | Medi ...@@ -346,13 +345,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli017, Function | Medi
* @tc.name : Obtaining BuildType for multiple times * @tc.name : Obtaining BuildType for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli018, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli018,
Function | MediumTest | Level1) {
const char* value1 = GetBuildType(); const char* value1 = GetBuildType();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetBuildType();
const char* value = GetBuildType();
} }
const char* value2 = GetBuildType(); const char* value2 = GetBuildType();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -363,13 +362,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli018, Function | Medi ...@@ -363,13 +362,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli018, Function | Medi
* @tc.name : Obtaining BuildUser for multiple times * @tc.name : Obtaining BuildUser for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli019, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli019,
Function | MediumTest | Level1) {
const char* value1 = GetBuildUser(); const char* value1 = GetBuildUser();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetBuildUser();
const char* value = GetBuildUser();
} }
const char* value2 = GetBuildUser(); const char* value2 = GetBuildUser();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -380,13 +379,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli019, Function | Medi ...@@ -380,13 +379,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli019, Function | Medi
* @tc.name : Obtaining BuildHost for multiple times * @tc.name : Obtaining BuildHost for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli020, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli020,
Function | MediumTest | Level1) {
const char* value1 = GetBuildHost(); const char* value1 = GetBuildHost();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetBuildHost();
const char* value = GetBuildHost();
} }
const char* value2 = GetBuildHost(); const char* value2 = GetBuildHost();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -397,13 +396,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli020, Function | Medi ...@@ -397,13 +396,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli020, Function | Medi
* @tc.name : Obtaining BuildTime for multiple times * @tc.name : Obtaining BuildTime for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli021, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli021,
Function | MediumTest | Level1) {
const char* value1 = GetBuildTime(); const char* value1 = GetBuildTime();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetBuildTime();
const char* value = GetBuildTime();
} }
const char* value2 = GetBuildTime(); const char* value2 = GetBuildTime();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -414,13 +413,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli021, Function | Medi ...@@ -414,13 +413,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli021, Function | Medi
* @tc.name : Obtaining BuildRootHash for multiple times * @tc.name : Obtaining BuildRootHash for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli022, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli022,
Function | MediumTest | Level1) {
const char* value1 = GetBuildRootHash(); const char* value1 = GetBuildRootHash();
TEST_ASSERT_NOT_NULL(value1); TEST_ASSERT_NOT_NULL(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetBuildRootHash();
const char* value = GetBuildRootHash();
} }
const char* value2 = GetBuildRootHash(); const char* value2 = GetBuildRootHash();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -431,13 +430,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli022, Function | Medi ...@@ -431,13 +430,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli022, Function | Medi
* @tc.name : Obtaining SoftwareModel for multiple times * @tc.name : Obtaining SoftwareModel for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli023, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli023,
Function | MediumTest | Level1) {
const char* value1 = GetSoftwareModel(); const char* value1 = GetSoftwareModel();
AssertNotEmpty(value1); AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ const char* value = GetSoftwareModel();
const char* value = GetSoftwareModel();
} }
const char* value2 = GetSoftwareModel(); const char* value2 = GetSoftwareModel();
TEST_ASSERT_EQUAL_STRING(value1, value2); TEST_ASSERT_EQUAL_STRING(value1, value2);
...@@ -448,14 +447,14 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli023, Function | Medi ...@@ -448,14 +447,14 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli023, Function | Medi
* @tc.name : Obtaining SdkApiLevel for multiple times * @tc.name : Obtaining SdkApiLevel for multiple times
* @tc.desc : [C- SOFTWARE -0200] * @tc.desc : [C- SOFTWARE -0200]
*/ */
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli024, Function | MediumTest | Level1) LITE_TEST_CASE(ParameterReliTestSuite,
{ testObtainSysParaReli024,
Function | MediumTest | Level1) {
int value1 = GetSdkApiVersion(); int value1 = GetSdkApiVersion();
TEST_ASSERT_NOT_NULL(value1); TEST_ASSERT_NOT_NULL(value1);
TEST_ASSERT_TRUE((int)value1 == value1); TEST_ASSERT_TRUE((int)value1 == value1);
for (int i = 0; i < QUERY_TIMES; i++) for (int i = 0; i < QUERY_TIMES; i++) {
{ int value = GetSdkApiVersion();
int value = GetSdkApiVersion();
} }
int value2 = GetSdkApiVersion(); int value2 = GetSdkApiVersion();
TEST_ASSERT_EQUAL_INT(value1, value2); TEST_ASSERT_EQUAL_INT(value1, value2);
......
...@@ -13,11 +13,10 @@ ...@@ -13,11 +13,10 @@
* limitations under the License. * limitations under the License.
*/ */
#include "hctest.h"
#include "parameter_utils.h" #include "parameter_utils.h"
#include "hctest.h"
void AssertNotEmpty(const char* sysPara) void AssertNotEmpty(const char* sysPara) {
{
TEST_ASSERT_NOT_NULL(sysPara); TEST_ASSERT_NOT_NULL(sysPara);
if (sysPara != NULL) { if (sysPara != NULL) {
TEST_ASSERT_TRUE(strlen(sysPara) > 0); TEST_ASSERT_TRUE(strlen(sysPara) > 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册