提交 887b35d6 编写于 作者: N nan-xiansen

【start_lite】【master】add SecurityPatchTag interface time format verification case

Signed-off-by: Nnan-xiansen <nanjinbin@huawei.com>
Change-Id: I38b6ebec44bf8a6f19ffedcd38596c0778db9bfa
上级 6391998b
......@@ -19,12 +19,12 @@
#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 ***...";
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
......@@ -40,7 +40,7 @@ LITE_TEST_SUIT(utils, parameter, ParameterFuncTestSuite);
*/
static BOOL ParameterFuncTestSuiteSetUp(void)
{
return TRUE;
return TRUE;
}
/**
......@@ -49,8 +49,8 @@ static BOOL ParameterFuncTestSuiteSetUp(void)
*/
static BOOL ParameterFuncTestSuiteTearDown(void)
{
printf("+-------------------------------------------+\n");
return TRUE;
printf("+-------------------------------------------+\n");
return TRUE;
}
/**
......@@ -60,9 +60,9 @@ static BOOL ParameterFuncTestSuiteTearDown(void)
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara001, Function | MediumTest | Level1)
{
const char* value = GetDeviceType();
printf("Device Type=%s\n", value);
AssertNotEmpty(value);
const char *value = GetDeviceType();
printf("Device Type=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -72,9 +72,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara001, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara002, Function | MediumTest | Level1)
{
const char* value = GetManufacture();
printf("Manufacture=%s\n", value);
AssertNotEmpty(value);
const char *value = GetManufacture();
printf("Manufacture=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -84,9 +84,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara002, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara003, Function | MediumTest | Level1)
{
const char* value = GetBrand();
printf("Brand=%s\n", value);
AssertNotEmpty(value);
const char *value = GetBrand();
printf("Brand=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -96,9 +96,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara003, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara004, Function | MediumTest | Level1)
{
const char* value = GetMarketName();
printf("Market Name=%s\n", value);
AssertNotEmpty(value);
const char *value = GetMarketName();
printf("Market Name=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -108,9 +108,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara004, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara005, Function | MediumTest | Level1)
{
const char* value = GetProductSeries();
printf("Product Series=%s\n", value);
AssertNotEmpty(value);
const char *value = GetProductSeries();
printf("Product Series=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -120,9 +120,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara005, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara006, Function | MediumTest | Level1)
{
const char* value = GetProductModel();
printf("Product Model=%s\n", value);
AssertNotEmpty(value);
const char *value = GetProductModel();
printf("Product Model=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -132,9 +132,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara006, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara007, Function | MediumTest | Level1)
{
const char* value = GetHardwareModel();
printf("Hardware Model=%s\n", value);
AssertNotEmpty(value);
const char *value = GetHardwareModel();
printf("Hardware Model=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -144,9 +144,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara007, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara008, Function | MediumTest | Level1)
{
const char* value = GetHardwareProfile();
printf("Hardware Profile=%s\n", value);
AssertNotEmpty(value);
const char *value = GetHardwareProfile();
printf("Hardware Profile=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -156,9 +156,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara008, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara009, Function | MediumTest | Level1)
{
const char* value = GetSerial();
printf("Serial=%s\n", value);
AssertNotEmpty(value);
const char *value = GetSerial();
printf("Serial=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -168,9 +168,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara009, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara010, Function | MediumTest | Level1)
{
const char* value = GetOSFullName();
printf("Os Name=%s\n", value);
AssertNotEmpty(value);
const char *value = GetOSFullName();
printf("Os Name=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -180,9 +180,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara010, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara011, Function | MediumTest | Level1)
{
const char* value = GetDisplayVersion();
printf("Display Version=%s\n", value);
AssertNotEmpty(value);
const char *value = GetDisplayVersion();
printf("Display Version=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -192,9 +192,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara011, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara012, Function | MediumTest | Level1)
{
const char* value = GetBootloaderVersion();
printf("Bootloader Version=%s\n", value);
AssertNotEmpty(value);
const char *value = GetBootloaderVersion();
printf("Bootloader Version=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -204,9 +204,24 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara012, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara013, Function | MediumTest | Level1)
{
const char* value = GetSecurityPatchTag();
printf("Secure Patch Level=%s\n", value);
AssertNotEmpty(value);
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);
AssertNotEmpty(value);
char *str;
sscanf(*value, "/^[1-2]{1}([0-9]{3})-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/", *str);
TEST_ASSERT_TRUE(*str == *value)
};
/**
......@@ -216,9 +231,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara013, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara014, Function | MediumTest | Level1)
{
const char* value = GetAbiList();
printf("Abi List=%s\n", value);
AssertNotEmpty(value);
const char *value = GetAbiList();
printf("Abi List=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -228,9 +243,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara014, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara015, Function | MediumTest | Level1)
{
int value = GetFirstApiVersion();
printf("First Api Level=%d\n", value);
TEST_ASSERT_TRUE(value > 0);
int value = GetFirstApiVersion();
printf("First Api Level=%d\n", value);
TEST_ASSERT_TRUE(value > 0);
};
/**
......@@ -240,9 +255,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara015, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara016, Function | MediumTest | Level1)
{
const char* value = GetIncrementalVersion();
printf("Incremental Version=%s\n", value);
AssertNotEmpty(value);
const char *value = GetIncrementalVersion();
printf("Incremental Version=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -252,9 +267,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara016, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara017, Function | MediumTest | Level1)
{
const char* value = GetVersionId();
printf("Version Id=%s\n", value);
AssertNotEmpty(value);
const char *value = GetVersionId();
printf("Version Id=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -264,9 +279,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara017, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara018, Function | MediumTest | Level1)
{
const char* value = GetBuildType();
printf("Build Type=%s\n", value);
AssertNotEmpty(value);
const char *value = GetBuildType();
printf("Build Type=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -276,9 +291,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara018, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara019, Function | MediumTest | Level1)
{
const char* value = GetBuildUser();
printf("Build User=%s\n", value);
AssertNotEmpty(value);
const char *value = GetBuildUser();
printf("Build User=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -288,9 +303,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara019, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara020, Function | MediumTest | Level1)
{
const char* value = GetBuildHost();
printf("Build Host=%s\n", value);
AssertNotEmpty(value);
const char *value = GetBuildHost();
printf("Build Host=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -300,9 +315,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara020, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara021, Function | MediumTest | Level1)
{
const char* value = GetBuildTime();
printf("Build Time=%s\n", value);
AssertNotEmpty(value);
const char *value = GetBuildTime();
printf("Build Time=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -312,9 +327,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara021, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara022, Function | MediumTest | Level1)
{
const char* value = GetBuildRootHash();
printf("Build Root Hash=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
const char *value = GetBuildRootHash();
printf("Build Root Hash=%s\n", value);
TEST_ASSERT_NOT_NULL(value);
};
/**
......@@ -324,9 +339,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara022, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara023, Function | MediumTest | Level1)
{
const char* value = GetSoftwareModel();
printf("Software Model=%s\n", value);
AssertNotEmpty(value);
const char *value = GetSoftwareModel();
printf("Software Model=%s\n", value);
AssertNotEmpty(value);
};
/**
......@@ -336,9 +351,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara023, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara024, Function | MediumTest | Level1)
{
int value = GetSdkApiVersion();
printf("Sdk Api Level=%d\n", value);
TEST_ASSERT_TRUE(value > 0);
int value = GetSdkApiVersion();
printf("Sdk Api Level=%d\n", value);
TEST_ASSERT_TRUE(value > 0);
};
/**
......@@ -348,12 +363,12 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara024, Function | MediumTe
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter001, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "rw.sys.version_606";
char value[] = "OEM-10.1.0";
ret = SetParameter(key, value);
TEST_ASSERT_EQUAL_INT(0, ret);
char key[] = "rw.sys.version_606";
char value[] = "OEM-10.1.0";
ret = SetParameter(key, value);
TEST_ASSERT_EQUAL_INT(0, ret);
};
/**
......@@ -363,12 +378,12 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter001, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter002, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "_._..__...___";
char value[] = "!@#¥%……&*()——+~《》?,。、“‘;:、12345767890";
ret = SetParameter(key, value);
TEST_ASSERT_EQUAL_INT(0, ret);
char key[] = "_._..__...___";
char value[] = "!@#¥%……&*()——+~《》?,。、“‘;:、12345767890";
ret = SetParameter(key, value);
TEST_ASSERT_EQUAL_INT(0, ret);
};
/**
......@@ -378,12 +393,12 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter002, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter003, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "keywithonlylowercase";
char value[] = "test key with only lowercase";
ret = SetParameter(key, value);
TEST_ASSERT_EQUAL_INT(0, ret);
char key[] = "keywithonlylowercase";
char value[] = "test key with only lowercase";
ret = SetParameter(key, value);
TEST_ASSERT_EQUAL_INT(0, ret);
};
/**
......@@ -393,12 +408,12 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter003, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter004, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "202006060602";
char value[] = "test key with only number";
ret = SetParameter(key, value);
TEST_ASSERT_EQUAL_INT(0, ret);
char key[] = "202006060602";
char value[] = "test key with only number";
ret = SetParameter(key, value);
TEST_ASSERT_EQUAL_INT(0, ret);
};
/**
......@@ -408,18 +423,18 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter004, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter005, Function | MediumTest | Level1)
{
int ret;
int ret;
char key1[] = "rw.sys.version.version.version.";
char value1[] = "set with key = 31";
ret = SetParameter(key1, value1);
TEST_ASSERT_EQUAL_INT(0, ret);
char key1[] = "rw.sys.version.version.version.";
char value1[] = "set with key = 31";
ret = SetParameter(key1, value1);
TEST_ASSERT_EQUAL_INT(0, ret);
char key2[] = "rw.sys.version.version";
char value2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
char key2[] = "rw.sys.version.version";
char value2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs";
ret = SetParameter(key2, value2);
TEST_ASSERT_EQUAL_INT(0, ret);
ret = SetParameter(key2, value2);
TEST_ASSERT_EQUAL_INT(0, ret);
};
/**
......@@ -429,21 +444,21 @@ abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs";
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter006, Function | MediumTest | Level1)
{
int ret;
int ret;
char value[] = "test with null";
ret = SetParameter(NULL, value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
char value[] = "test with null";
ret = SetParameter(NULL, value);
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
char key[] = "rw.sys.version";
ret = SetParameter(key, NULL);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -453,21 +468,21 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter006, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter007, Function | MediumTest | Level1)
{
int ret;
int ret;
char value[] = "test with null";
ret = SetParameter("\0", value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
char value[] = "test with null";
ret = SetParameter("\0", value);
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
char key[] = "rw.sys.version";
ret = SetParameter(key, "\0");
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -477,23 +492,23 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter007, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter008, Function | MediumTest | Level1)
{
int ret;
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
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))
{
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))
{
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -503,15 +518,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter008, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter009, Function | MediumTest | Level1)
{
int ret;
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
char key[] = "Rw.Sys.Version.Version";
char value[] = "set value with uppercase";
ret = SetParameter(key, value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -521,15 +536,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter009, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter010, Function | MediumTest | Level1)
{
int ret;
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
char key[] = "rw sys version version";
char value[] = "set value with blank";
ret = SetParameter(key, value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -539,15 +554,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter010, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter011, Function | MediumTest | Level1)
{
int ret;
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
char key[] = "rw+sys&version%version*";
char value[] = "set value with special characters";
ret = SetParameter(key, value);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -557,25 +572,25 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter011, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter012, Function | MediumTest | Level1)
{
int ret;
int ret;
char key1[] = "rw.sys.version.version1";
char value1[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
char key1[] = "rw.sys.version.version1";
char value1[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrst";
ret = SetParameter(key1, value1);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
char key2[] = "rw.sys.version.version2";
char value2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
ret = SetParameter(key1, value1);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
char key2[] = "rw.sys.version.version2";
char value2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890";
ret = SetParameter(key2, value2);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
ret = SetParameter(key2, value2);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -585,12 +600,12 @@ abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890";
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter013, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "key_for_blank_value";
char value[] = " ";
ret = SetParameter(key, value);
TEST_ASSERT_EQUAL_INT(0, ret);
char key[] = "key_for_blank_value";
char value[] = " ";
ret = SetParameter(key, value);
TEST_ASSERT_EQUAL_INT(0, ret);
};
/**
......@@ -600,15 +615,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter013, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter001, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "rw.sys.version_606";
char rightVal[] = "OEM-10.1.0";
char value[MAX_LEN] = {0};
SetParameter(key, rightVal);
ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
TEST_ASSERT_EQUAL_STRING(rightVal, value);
char key[] = "rw.sys.version_606";
char rightVal[] = "OEM-10.1.0";
char value[MAX_LEN] = {0};
SetParameter(key, rightVal);
ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
TEST_ASSERT_EQUAL_STRING(rightVal, value);
};
/**
......@@ -618,15 +633,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter001, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter002, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "_._..__...___";
char rightVal[] = "!@#¥%……&*()——+~《》?,。、“‘;:、12345767890";
char value[MAX_LEN] = {0};
SetParameter(key, rightVal);
ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
TEST_ASSERT_EQUAL_STRING(rightVal, value);
char key[] = "_._..__...___";
char rightVal[] = "!@#¥%……&*()——+~《》?,。、“‘;:、12345767890";
char value[MAX_LEN] = {0};
SetParameter(key, rightVal);
ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
TEST_ASSERT_EQUAL_STRING(rightVal, value);
};
/**
......@@ -636,15 +651,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter002, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter003, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "keywithonlylowercase";
char rightVal[] = "test key with only lowercase";
char value[MAX_LEN] = {0};
SetParameter(key, rightVal);
ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
TEST_ASSERT_EQUAL_STRING(rightVal, value);
char key[] = "keywithonlylowercase";
char rightVal[] = "test key with only lowercase";
char value[MAX_LEN] = {0};
SetParameter(key, rightVal);
ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
TEST_ASSERT_EQUAL_STRING(rightVal, value);
};
/**
......@@ -654,15 +669,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter003, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter004, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "202006060602";
char rightVal[] = "test key with only number";
char value[MAX_LEN] = {0};
SetParameter(key, rightVal);
ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
TEST_ASSERT_EQUAL_STRING(rightVal, value);
char key[] = "202006060602";
char rightVal[] = "test key with only number";
char value[MAX_LEN] = {0};
SetParameter(key, rightVal);
ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
TEST_ASSERT_EQUAL_STRING(rightVal, value);
};
/**
......@@ -672,15 +687,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter004, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter005, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "rw.sys.version_606";
char rightVal[] = "OEM-10.1.0";
char value[MAX_LEN] = {0};
SetParameter(key, rightVal);
ret = GetParameter(key, NULL, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
TEST_ASSERT_EQUAL_STRING(rightVal, value);
char key[] = "rw.sys.version_606";
char rightVal[] = "OEM-10.1.0";
char value[MAX_LEN] = {0};
SetParameter(key, rightVal);
ret = GetParameter(key, NULL, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
TEST_ASSERT_EQUAL_STRING(rightVal, value);
};
/**
......@@ -690,13 +705,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter005, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter006, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "none.exist.key";
char value[MAX_LEN] = {0};
ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(g_defSysParam), ret);
TEST_ASSERT_EQUAL_STRING(g_defSysParam, value);
char key[] = "none.exist.key";
char value[MAX_LEN] = {0};
ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(g_defSysParam), ret);
TEST_ASSERT_EQUAL_STRING(g_defSysParam, value);
};
/**
......@@ -706,24 +721,24 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter006, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter007, Function | MediumTest | Level1)
{
int ret;
int ret;
char key1[] = "rw.sys.version.version.version.";
char rightVal1[] = "set with key = 31";
char value1[MAX_LEN] = {0};
SetParameter(key1, rightVal1);
ret = GetParameter(key1, g_defSysParam, value1, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal1), ret);
TEST_ASSERT_EQUAL_STRING(rightVal1, value1);
char key1[] = "rw.sys.version.version.version.";
char rightVal1[] = "set with key = 31";
char value1[MAX_LEN] = {0};
SetParameter(key1, rightVal1);
ret = GetParameter(key1, g_defSysParam, value1, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal1), ret);
TEST_ASSERT_EQUAL_STRING(rightVal1, value1);
char key2[] = "rw.sys.version.version";
char rightVal2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
char key2[] = "rw.sys.version.version";
char rightVal2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs";
char value2[MAX_LEN] = {0};
SetParameter(key2, rightVal2);
ret = GetParameter(key2, g_defSysParam, value2, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal2), ret);
TEST_ASSERT_EQUAL_STRING(rightVal2, value2);
char value2[MAX_LEN] = {0};
SetParameter(key2, rightVal2);
ret = GetParameter(key2, g_defSysParam, value2, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal2), ret);
TEST_ASSERT_EQUAL_STRING(rightVal2, value2);
};
/**
......@@ -733,17 +748,17 @@ abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs";
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter008, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "rw.sys.version_606";
char rightVal[] = "OEM-10.1.0";
char value[INVALID_LEN] = {0};
SetParameter(key, rightVal);
ret = GetParameter(key, g_defSysParam, value, INVALID_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
char key[] = "rw.sys.version_606";
char rightVal[] = "OEM-10.1.0";
char value[INVALID_LEN] = {0};
SetParameter(key, rightVal);
ret = GetParameter(key, g_defSysParam, value, INVALID_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -753,16 +768,16 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter008, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter009, Function | MediumTest | Level1)
{
int ret;
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -772,12 +787,12 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter009, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter010, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "none.exist.key";
char value[INVALID_LEN] = {0};
ret = GetParameter(key, g_defSysParam, value, INVALID_LEN);
TEST_ASSERT_EQUAL_INT(-1, ret);
char key[] = "none.exist.key";
char value[INVALID_LEN] = {0};
ret = GetParameter(key, g_defSysParam, value, INVALID_LEN);
TEST_ASSERT_EQUAL_INT(-1, ret);
};
/**
......@@ -787,12 +802,12 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter010, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter011, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "none.exist.key";
char value[MAX_LEN] = {0};
ret = GetParameter(key, NULL, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(-1, ret);
char key[] = "none.exist.key";
char value[MAX_LEN] = {0};
ret = GetParameter(key, NULL, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(-1, ret);
};
/**
......@@ -802,15 +817,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter011, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter012, Function | MediumTest | Level1)
{
int ret;
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -820,15 +835,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter012, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter013, Function | MediumTest | Level1)
{
int ret;
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -838,14 +853,14 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter013, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter014, Function | MediumTest | Level1)
{
int ret;
int ret;
char value[MAX_LEN] = {0};
ret = GetParameter(NULL, g_defSysParam, value, MAX_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
char value[MAX_LEN] = {0};
ret = GetParameter(NULL, g_defSysParam, value, MAX_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -855,15 +870,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter014, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter015, Function | MediumTest | Level1)
{
int ret;
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -873,15 +888,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter015, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter016, Function | MediumTest | Level1)
{
int ret;
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -891,15 +906,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter016, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter017, Function | MediumTest | Level1)
{
int ret;
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
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))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -909,14 +924,14 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter017, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter018, Function | MediumTest | Level1)
{
int ret;
int ret;
char value[MAX_LEN] = {0};
ret = GetParameter("\0", g_defSysParam, value, MAX_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
char value[MAX_LEN] = {0};
ret = GetParameter("\0", g_defSysParam, value, MAX_LEN);
if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
{
TEST_ASSERT_EQUAL_INT(1, 1);
}
};
/**
......@@ -926,15 +941,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter018, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter019, Function | MediumTest | Level1)
{
int ret;
int ret;
char key[] = "key_for_blank_value";
char rightVal[] = " ";
char value[MAX_LEN] = {0};
SetParameter(key, rightVal);
ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
TEST_ASSERT_EQUAL_STRING(rightVal, value);
char key[] = "key_for_blank_value";
char rightVal[] = " ";
char value[MAX_LEN] = {0};
SetParameter(key, rightVal);
ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
TEST_ASSERT_EQUAL_STRING(rightVal, value);
};
/**
......@@ -944,24 +959,24 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter019, Function | MediumTes
*/
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter020, Function | MediumTest | Level1)
{
int ret;
char key[] = "rw.sys.version_606";
char rightVal1[] = "OEM-10.1.0";
char value1[MAX_LEN] = {0};
ret = SetParameter(key, rightVal1);
TEST_ASSERT_EQUAL_INT(0, ret);
ret = GetParameter(key, g_defSysParam, value1, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal1), ret);
TEST_ASSERT_EQUAL_STRING(rightVal1, value1);
char rightVal2[] = "update the value of OEM-10.1.0";
char value2[MAX_LEN] = {0};
ret = SetParameter(key, rightVal2);
TEST_ASSERT_EQUAL_INT(0, ret);
ret = GetParameter(key, g_defSysParam, value2, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal2), ret);
TEST_ASSERT_EQUAL_STRING(rightVal2, value2);
int ret;
char key[] = "rw.sys.version_606";
char rightVal1[] = "OEM-10.1.0";
char value1[MAX_LEN] = {0};
ret = SetParameter(key, rightVal1);
TEST_ASSERT_EQUAL_INT(0, ret);
ret = GetParameter(key, g_defSysParam, value1, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal1), ret);
TEST_ASSERT_EQUAL_STRING(rightVal1, value1);
char rightVal2[] = "update the value of OEM-10.1.0";
char value2[MAX_LEN] = {0};
ret = SetParameter(key, rightVal2);
TEST_ASSERT_EQUAL_INT(0, ret);
ret = GetParameter(key, g_defSysParam, value2, MAX_LEN);
TEST_ASSERT_EQUAL_INT(strlen(rightVal2), ret);
TEST_ASSERT_EQUAL_STRING(rightVal2, value2);
};
RUN_TEST_SUITE(ParameterFuncTestSuite);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册