未验证 提交 32358f71 编写于 作者: O openharmony_ci 提交者: Gitee

!5347 【startup_lite】【master】modify device info api test case.

Merge pull request !5347 from leiyuqian/startuplite0901
......@@ -16,6 +16,7 @@ import("//test/xts/tools/lite/build/suite_lite.gni")
hctest_suite("ActsParameterTest") {
suite_name = "acts"
sources = [
"src/deviceinfo_func_test.c",
"src/parameter_func_test.c",
"src/parameter_reli_test.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 @@
* limitations under the License.
*/
#include "ohos_types.h"
#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 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
* @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 ParameterFuncTestSuite
......@@ -53,318 +54,14 @@ static BOOL ParameterFuncTestSuiteTearDown(void)
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.name : SetParameter parameter legal test
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter001, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testSetParameter001,
Function | MediumTest | Level1) {
int ret;
char key[] = "rw.sys.version_606";
......@@ -378,8 +75,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter001, Function | MediumTes
* @tc.name : SetParameter parameter legal test with Special characters
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter002, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testSetParameter002,
Function | MediumTest | Level1) {
int ret;
char key[] = "_._..__...___";
......@@ -390,11 +88,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter002, Function | MediumTes
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter003, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testSetParameter003,
Function | MediumTest | Level1) {
int ret;
char key[] = "keywithonlylowercase";
......@@ -408,8 +108,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter003, Function | MediumTes
* @tc.name : SetParameter parameter legal test using key with only number
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter004, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testSetParameter004,
Function | MediumTest | Level1) {
int ret;
char key[] = "202006060602";
......@@ -420,11 +121,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter004, Function | MediumTes
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter005, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testSetParameter005,
Function | MediumTest | Level1) {
int ret;
char key1[] = "rw.sys.version.version.version";
......@@ -433,7 +136,8 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter005, Function | MediumTes
TEST_ASSERT_EQUAL_INT(0, ret);
char key2[] = "rw.sys.version.version";
char value2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklm\
char value2[] =
"abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklm\
nopqrstuvwxyz1234567890abcdefghijklmnopqrstuvw";
ret = SetParameter(key2, value2);
TEST_ASSERT_EQUAL_INT(0, ret);
......@@ -441,74 +145,74 @@ nopqrstuvwxyz1234567890abcdefghijklmnopqrstuvw";
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter006, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testSetParameter006,
Function | MediumTest | Level1) {
int ret;
char value[] = "test with null";
ret = SetParameter(NULL, value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
TEST_ASSERT_EQUAL_INT(1, 1);
}
char key[] = "rw.sys.version";
ret = SetParameter(key, NULL);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter007, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testSetParameter007,
Function | MediumTest | Level1) {
int ret;
char value[] = "test with null";
ret = SetParameter("\0", value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
TEST_ASSERT_EQUAL_INT(1, 1);
}
char key[] = "rw.sys.version";
ret = SetParameter(key, "\0");
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter008, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testSetParameter008,
Function | MediumTest | Level1) {
int ret;
char key1[] = "rw.sys.version.version.version.v";
char value1[] = "set with key = 32";
ret = SetParameter(key1, value1);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
TEST_ASSERT_EQUAL_INT(1, 1);
}
char key2[] = "rw.sys.version.version.version.version";
char value2[] = "set with key > 32";
ret = SetParameter(key2, value2);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
......@@ -518,15 +222,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter008, Function | MediumTes
* @tc.name : SetParameter parameter illegal test using key with uppercase
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter009, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testSetParameter009,
Function | MediumTest | Level1) {
int ret;
char key[] = "Rw.Sys.Version.Version";
char value[] = "set value with uppercase";
ret = SetParameter(key, value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
......@@ -536,72 +240,77 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter009, Function | MediumTes
* @tc.name : SetParameter parameter illegal test using key with blank
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter010, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testSetParameter010,
Function | MediumTest | Level1) {
int ret;
char key[] = "rw sys version version";
char value[] = "set value with blank";
ret = SetParameter(key, value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter011, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testSetParameter011,
Function | MediumTest | Level1) {
int ret;
char key[] = "rw+sys&version%version*";
char value[] = "set value with special characters";
ret = SetParameter(key, value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter012, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testSetParameter012,
Function | MediumTest | Level1) {
int ret;
char key1[] = "rw.sys.version.version1";
char value1[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
char value1[] =
"abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrst";
ret = SetParameter(key1, value1);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
TEST_ASSERT_EQUAL_INT(1, 1);
}
char key2[] = "rw.sys.version.version2";
char value2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
char value2[] =
"abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890";
ret = SetParameter(key2, value2);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) {
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter013, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testSetParameter013,
Function | MediumTest | Level1) {
int ret;
char key[] = "key_for_blank_value";
......@@ -615,8 +324,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter013, Function | MediumTes
* @tc.name : GetParameter parameter legal test
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter001, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter001,
Function | MediumTest | Level1) {
int ret;
char key[] = "rw.sys.version_606";
......@@ -633,8 +343,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter001, Function | MediumTes
* @tc.name : GetParameter parameter legal test with Special characters
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter002, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter002,
Function | MediumTest | Level1) {
int ret;
char key[] = "_._..__...___";
......@@ -648,11 +359,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter002, Function | MediumTes
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter003, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter003,
Function | MediumTest | Level1) {
int ret;
char key[] = "keywithonlylowercase";
......@@ -669,8 +382,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter003, Function | MediumTes
* @tc.name : GetParameter parameter legal test using key with only number
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter004, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter004,
Function | MediumTest | Level1) {
int ret;
char key[] = "202006060602";
......@@ -684,11 +398,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter004, Function | MediumTes
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter005, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter005,
Function | MediumTest | Level1) {
int ret;
char key[] = "rw.sys.version_606";
......@@ -705,8 +421,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter005, Function | MediumTes
* @tc.name : GetParameter parameter legal test when the key is not exist
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter006, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter006,
Function | MediumTest | Level1) {
int ret;
char key[] = "none.exist.key";
......@@ -718,11 +435,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter006, Function | MediumTes
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter007, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter007,
Function | MediumTest | Level1) {
int ret;
char key1[] = "rw.sys.version.version.version";
......@@ -734,7 +453,8 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter007, Function | MediumTes
TEST_ASSERT_EQUAL_STRING(rightVal1, value1);
char key2[] = "rw.sys.version.version";
char rightVal2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefgh\
char rightVal2[] =
"abcdefghijklmnopqrstuvwxyz1234567890abcdefgh\
ijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvw";
char value2[MAX_LEN] = {0};
SetParameter(key2, rightVal2);
......@@ -748,8 +468,9 @@ ijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvw";
* @tc.name : GetParameter parameter illegal test with invalid value length
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter008, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter008,
Function | MediumTest | Level1) {
int ret;
char key[] = "rw.sys.version_606";
......@@ -757,38 +478,40 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter008, Function | MediumTes
char value[INVALID_LEN] = {0};
SetParameter(key, rightVal);
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);
}
};
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter009, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter009,
Function | MediumTest | Level1) {
int ret;
char key[] = "rw.sys.version_606";
char rightVal[] = "OEM-10.1.0";
SetParameter(key, rightVal);
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);
}
};
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter010, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter010,
Function | MediumTest | Level1) {
int ret;
char key[] = "none.exist.key";
......@@ -799,11 +522,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter010, Function | MediumTes
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter011, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter011,
Function | MediumTest | Level1) {
int ret;
char key[] = "none.exist.key";
......@@ -817,33 +542,34 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter011, Function | MediumTes
* @tc.name : GetParameter parameter illegal test when key len is 32 bytes
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter012, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter012,
Function | MediumTest | Level1) {
int ret;
char key[] = "rw.sys.version.version.version.v";
char value[MAX_LEN] = {0};
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);
}
};
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter013, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter013,
Function | MediumTest | Level1) {
int ret;
char key[] = "rw.sys.version.version.version.version";
char value[MAX_LEN] = {0};
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);
}
};
......@@ -853,14 +579,14 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter013, Function | MediumTes
* @tc.name : GetParameter parameter illegal test when key is nullptr
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter014, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter014,
Function | MediumTest | Level1) {
int ret;
char value[MAX_LEN] = {0};
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);
}
};
......@@ -870,15 +596,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter014, Function | MediumTes
* @tc.name : GetParameter parameter illegal test using key with uppercase
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter015, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter015,
Function | MediumTest | Level1) {
int ret;
char key[] = "Rw.Sys.Version.Version";
char value[MAX_LEN] = {0};
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);
}
};
......@@ -888,33 +614,34 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter015, Function | MediumTes
* @tc.name : GetParameter parameter illegal test using key with blank
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter016, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter016,
Function | MediumTest | Level1) {
int ret;
char key[] = "rw sys version version";
char value[MAX_LEN] = {0};
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);
}
};
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter017, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter017,
Function | MediumTest | Level1) {
int ret;
char key[] = "rw+sys&version%version*";
char value[MAX_LEN] = {0};
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);
}
};
......@@ -924,25 +651,27 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter017, Function | MediumTes
* @tc.name : GetParameter parameter illegal test when key is NULL
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter018, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter018,
Function | MediumTest | Level1) {
int ret;
char value[MAX_LEN] = {0};
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);
}
};
/**
* @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]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter019, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter019,
Function | MediumTest | Level1) {
int ret;
char key[] = "key_for_blank_value";
......@@ -959,8 +688,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter019, Function | MediumTes
* @tc.name : Update value of parameter legal test
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter020, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterFuncTestSuite,
testGetParameter020,
Function | MediumTest | Level1) {
int ret;
char key[] = "rw.sys.version_606";
......
......@@ -13,16 +13,17 @@
* limitations under the License.
*/
#include "ohos_types.h"
#include <securec.h>
#include "hctest.h"
#include "ohos_types.h"
#include "parameter.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 : module name is parameter
* @param : test suit name is ParameterReliTestSuite
......@@ -53,13 +54,13 @@ static BOOL ParameterReliTestSuiteTearDown(void)
* @tc.name : Obtaining ProductType for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetDeviceType();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetDeviceType();
}
const char* value2 = GetDeviceType();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -70,13 +71,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli001, Function | Medi
* @tc.name : Obtaining Manufacture for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetManufacture();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetManufacture();
}
const char* value2 = GetManufacture();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -87,13 +88,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli002, Function | Medi
* @tc.name : Obtaining Brand for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetBrand();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetBrand();
}
const char* value2 = GetBrand();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -104,13 +105,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli003, Function | Medi
* @tc.name : Obtaining MarketName for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetMarketName();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetMarketName();
}
const char* value2 = GetMarketName();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -121,13 +122,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli004, Function | Medi
* @tc.name : Obtaining ProductSeries for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetProductSeries();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetProductSeries();
}
const char* value2 = GetProductSeries();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -138,13 +139,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli005, Function | Medi
* @tc.name : Obtaining ProductModel for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetProductModel();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetProductModel();
}
const char* value2 = GetProductModel();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -155,13 +156,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli006, Function | Medi
* @tc.name : Obtaining HardwareModel for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetHardwareModel();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetHardwareModel();
}
const char* value2 = GetHardwareModel();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -172,13 +173,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli007, Function | Medi
* @tc.name : Obtaining HardwareProfile for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetHardwareProfile();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetHardwareProfile();
}
const char* value2 = GetHardwareProfile();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -189,16 +190,16 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli008, Function | Medi
* @tc.name : Obtaining Serial for multiple times
* @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();
if (value1 == NULL) {
printf("The serial number needs to be written\n");
TEST_IGNORE();
}
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetSerial();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetSerial();
}
const char* value2 = GetSerial();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -209,13 +210,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli009, Function | Medi
* @tc.name : Obtaining OsName for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetOSFullName();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetOSFullName();
}
const char* value2 = GetOSFullName();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -226,13 +227,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli010, Function | Medi
* @tc.name : Obtaining DisplayVersion for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetDisplayVersion();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetDisplayVersion();
}
const char* value2 = GetDisplayVersion();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -243,13 +244,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli011, Function | Medi
* @tc.name : Obtaining BootloaderVersion for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetBootloaderVersion();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetBootloaderVersion();
}
const char* value2 = GetBootloaderVersion();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -260,13 +261,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli012, Function | Medi
* @tc.name : Obtaining SecurityPatchTag for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetSecurityPatchTag();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetSecurityPatchTag();
}
const char* value2 = GetSecurityPatchTag();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -277,13 +278,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli013, Function | Medi
* @tc.name : Obtaining AbiList for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetAbiList();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetAbiList();
}
const char* value2 = GetAbiList();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -294,14 +295,14 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli014, Function | Medi
* @tc.name : Obtaining FirstApiLevel for multiple times
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli015, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterReliTestSuite,
testObtainSysParaReli015,
Function | MediumTest | Level1) {
int value1 = GetFirstApiVersion();
TEST_ASSERT_NOT_NULL(value1);
TEST_ASSERT_TRUE((int)value1 == value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
int value = GetFirstApiVersion();
for (int i = 0; i < QUERY_TIMES; i++) {
int value = GetFirstApiVersion();
}
int value2 = GetFirstApiVersion();
TEST_ASSERT_EQUAL_INT(value1, value2);
......@@ -312,13 +313,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli015, Function | Medi
* @tc.name : Obtaining IncrementalVersion for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetIncrementalVersion();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetIncrementalVersion();
}
const char* value2 = GetIncrementalVersion();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -329,13 +330,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli016, Function | Medi
* @tc.name : Obtaining VersionId for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetVersionId();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetVersionId();
}
const char* value2 = GetVersionId();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -346,13 +347,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli017, Function | Medi
* @tc.name : Obtaining BuildType for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetBuildType();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetBuildType();
}
const char* value2 = GetBuildType();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -363,13 +364,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli018, Function | Medi
* @tc.name : Obtaining BuildUser for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetBuildUser();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetBuildUser();
}
const char* value2 = GetBuildUser();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -380,13 +381,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli019, Function | Medi
* @tc.name : Obtaining BuildHost for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetBuildHost();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetBuildHost();
}
const char* value2 = GetBuildHost();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -397,13 +398,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli020, Function | Medi
* @tc.name : Obtaining BuildTime for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetBuildTime();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetBuildTime();
}
const char* value2 = GetBuildTime();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -414,13 +415,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli021, Function | Medi
* @tc.name : Obtaining BuildRootHash for multiple times
* @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();
TEST_ASSERT_NOT_NULL(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetBuildRootHash();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetBuildRootHash();
}
const char* value2 = GetBuildRootHash();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -431,13 +432,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli022, Function | Medi
* @tc.name : Obtaining SoftwareModel for multiple times
* @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();
AssertNotEmpty(value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
const char* value = GetSoftwareModel();
for (int i = 0; i < QUERY_TIMES; i++) {
const char* value = GetSoftwareModel();
}
const char* value2 = GetSoftwareModel();
TEST_ASSERT_EQUAL_STRING(value1, value2);
......@@ -448,14 +449,14 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli023, Function | Medi
* @tc.name : Obtaining SdkApiLevel for multiple times
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli024, Function | MediumTest | Level1)
{
LITE_TEST_CASE(ParameterReliTestSuite,
testObtainSysParaReli024,
Function | MediumTest | Level1) {
int value1 = GetSdkApiVersion();
TEST_ASSERT_NOT_NULL(value1);
TEST_ASSERT_TRUE((int)value1 == value1);
for (int i = 0; i < QUERY_TIMES; i++)
{
int value = GetSdkApiVersion();
for (int i = 0; i < QUERY_TIMES; i++) {
int value = GetSdkApiVersion();
}
int value2 = GetSdkApiVersion();
TEST_ASSERT_EQUAL_INT(value1, value2);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册