parameter_func_test.c 28.8 KB
Newer Older
W
wenjun 已提交
1
/*
M
mamingshuai 已提交
2
 * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
W
wenjun 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15
 * 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.
 */

M
mamingshuai 已提交
16
#include "ohos_types.h"
W
wenjun 已提交
17 18 19 20 21
#include <securec.h>
#include "hctest.h"
#include "parameter.h"
#include "parameter_utils.h"

22 23
#define MAX_LEN 128
#define INVALID_LEN 2
W
wenjun 已提交
24 25 26
#define COMMON_ERROR (-1)
#define INVALID_PARAMETER (-9)

27
static const char *g_defSysParam = "data of sys param ***...";
W
wenjun 已提交
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42

/**
 * @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
 */
LITE_TEST_SUIT(utils, parameter, ParameterFuncTestSuite);

/**
 * @tc.setup     : setup for all testcases
 * @return       : setup result, TRUE is success, FALSE is fail
 */
static BOOL ParameterFuncTestSuiteSetUp(void)
{
43
  return TRUE;
W
wenjun 已提交
44 45 46 47 48 49 50 51
}

/**
 * @tc.teardown  : teardown for all testcases
 * @return       : teardown result, TRUE is success, FALSE is fail
 */
static BOOL ParameterFuncTestSuiteTearDown(void)
{
52 53
  printf("+-------------------------------------------+\n");
  return TRUE;
W
wenjun 已提交
54 55 56
}

/**
M
mamingshuai 已提交
57
 * @tc.number    : SUB_UTILS_PARAMETER_0100
58
 * @tc.name      : Obtaining system parameter DeviceType
W
wenjun 已提交
59 60
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
61
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara001, Function | MediumTest | Level1)
W
wenjun 已提交
62
{
63 64 65
  const char *value = GetDeviceType();
  printf("Device Type=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
66 67 68
};

/**
M
mamingshuai 已提交
69 70
 * @tc.number    : SUB_UTILS_PARAMETER_0200
 * @tc.name      : Obtaining system parameter Manufacture
W
wenjun 已提交
71 72
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
73
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara002, Function | MediumTest | Level1)
W
wenjun 已提交
74
{
75 76 77
  const char *value = GetManufacture();
  printf("Manufacture=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
78 79 80
};

/**
M
mamingshuai 已提交
81 82
 * @tc.number    : SUB_UTILS_PARAMETER_0300
 * @tc.name      : Obtaining system parameter Brand
W
wenjun 已提交
83 84
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
85
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara003, Function | MediumTest | Level1)
W
wenjun 已提交
86
{
87 88 89
  const char *value = GetBrand();
  printf("Brand=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
90 91 92
};

/**
M
mamingshuai 已提交
93 94
 * @tc.number    : SUB_UTILS_PARAMETER_0400
 * @tc.name      : Obtaining system parameter MarketName
W
wenjun 已提交
95 96
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
97
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara004, Function | MediumTest | Level1)
W
wenjun 已提交
98
{
99 100 101
  const char *value = GetMarketName();
  printf("Market Name=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
102 103 104
};

/**
M
mamingshuai 已提交
105 106
 * @tc.number    : SUB_UTILS_PARAMETER_0500
 * @tc.name      : Obtaining system parameter ProductSeries
W
wenjun 已提交
107 108
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
109
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara005, Function | MediumTest | Level1)
W
wenjun 已提交
110
{
111 112 113
  const char *value = GetProductSeries();
  printf("Product Series=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
114 115 116
};

/**
M
mamingshuai 已提交
117 118
 * @tc.number    : SUB_UTILS_PARAMETER_0600
 * @tc.name      : Obtaining system parameter ProductModel
W
wenjun 已提交
119 120
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
121
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara006, Function | MediumTest | Level1)
W
wenjun 已提交
122
{
123 124 125
  const char *value = GetProductModel();
  printf("Product Model=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
126 127 128
};

/**
M
mamingshuai 已提交
129 130
 * @tc.number    : SUB_UTILS_PARAMETER_0700
 * @tc.name      : Obtaining system parameter HardwareModel
W
wenjun 已提交
131 132
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
133
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara007, Function | MediumTest | Level1)
W
wenjun 已提交
134
{
135 136 137
  const char *value = GetHardwareModel();
  printf("Hardware Model=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
138 139 140
};

/**
M
mamingshuai 已提交
141 142
 * @tc.number    : SUB_UTILS_PARAMETER_0800
 * @tc.name      : Obtaining system parameter HardwareProfile
W
wenjun 已提交
143 144
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
145
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara008, Function | MediumTest | Level1)
W
wenjun 已提交
146
{
147 148 149
  const char *value = GetHardwareProfile();
  printf("Hardware Profile=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
150 151 152
};

/**
M
mamingshuai 已提交
153 154
 * @tc.number    : SUB_UTILS_PARAMETER_0900
 * @tc.name      : Obtaining system parameter Serial
W
wenjun 已提交
155 156
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
157
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara009, Function | MediumTest | Level1)
W
wenjun 已提交
158
{
159 160 161
  const char *value = GetSerial();
  printf("Serial=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
162 163 164
};

/**
M
mamingshuai 已提交
165 166
 * @tc.number    : SUB_UTILS_PARAMETER_1000
 * @tc.name      : Obtaining system parameter OsName
W
wenjun 已提交
167 168
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
169
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara010, Function | MediumTest | Level1)
W
wenjun 已提交
170
{
171 172 173
  const char *value = GetOSFullName();
  printf("Os Name=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
174 175 176
};

/**
M
mamingshuai 已提交
177 178
 * @tc.number    : SUB_UTILS_PARAMETER_1100
 * @tc.name      : Obtaining system parameter DisplayVersion
W
wenjun 已提交
179 180
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
181
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara011, Function | MediumTest | Level1)
W
wenjun 已提交
182
{
183 184 185
  const char *value = GetDisplayVersion();
  printf("Display Version=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
186 187 188
};

/**
M
mamingshuai 已提交
189 190
 * @tc.number    : SUB_UTILS_PARAMETER_1200
 * @tc.name      : Obtaining system parameter BootloaderVersion
W
wenjun 已提交
191 192
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
193
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara012, Function | MediumTest | Level1)
W
wenjun 已提交
194
{
195 196 197
  const char *value = GetBootloaderVersion();
  printf("Bootloader Version=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
198 199 200
};

/**
M
mamingshuai 已提交
201 202
 * @tc.number    : SUB_UTILS_PARAMETER_1300
 * @tc.name      : Obtaining system parameter SecurityPatchTag
W
wenjun 已提交
203 204
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
205
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara013, Function | MediumTest | Level1)
W
wenjun 已提交
206
{
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
  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)
W
wenjun 已提交
225 226 227
};

/**
M
mamingshuai 已提交
228 229
 * @tc.number    : SUB_UTILS_PARAMETER_1400
 * @tc.name      : Obtaining system parameter AbiList
W
wenjun 已提交
230 231
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
232
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara014, Function | MediumTest | Level1)
W
wenjun 已提交
233
{
234 235 236
  const char *value = GetAbiList();
  printf("Abi List=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
237 238 239
};

/**
M
mamingshuai 已提交
240 241
 * @tc.number    : SUB_UTILS_PARAMETER_1500
 * @tc.name      : Obtaining system parameter FirstApiLevel
W
wenjun 已提交
242 243
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
244
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara015, Function | MediumTest | Level1)
W
wenjun 已提交
245
{
246 247 248
  int value = GetFirstApiVersion();
  printf("First Api Level=%d\n", value);
  TEST_ASSERT_TRUE(value > 0);
W
wenjun 已提交
249 250 251
};

/**
M
mamingshuai 已提交
252 253
 * @tc.number    : SUB_UTILS_PARAMETER_1600
 * @tc.name      : Obtaining system parameter IncrementalVersion
W
wenjun 已提交
254 255
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
256
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara016, Function | MediumTest | Level1)
W
wenjun 已提交
257
{
258 259 260
  const char *value = GetIncrementalVersion();
  printf("Incremental Version=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
261 262 263
};

/**
M
mamingshuai 已提交
264 265
 * @tc.number    : SUB_UTILS_PARAMETER_1700
 * @tc.name      : Obtaining system parameter VersionId
W
wenjun 已提交
266 267
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
268
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara017, Function | MediumTest | Level1)
W
wenjun 已提交
269
{
270 271 272
  const char *value = GetVersionId();
  printf("Version Id=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
273 274 275
};

/**
M
mamingshuai 已提交
276 277
 * @tc.number    : SUB_UTILS_PARAMETER_1800
 * @tc.name      : Obtaining system parameter BuildType
W
wenjun 已提交
278 279
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
280
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara018, Function | MediumTest | Level1)
W
wenjun 已提交
281
{
282 283 284
  const char *value = GetBuildType();
  printf("Build Type=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
285 286 287
};

/**
M
mamingshuai 已提交
288 289
 * @tc.number    : SUB_UTILS_PARAMETER_1900
 * @tc.name      : Obtaining system parameter BuildUser
W
wenjun 已提交
290 291
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
292
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara019, Function | MediumTest | Level1)
W
wenjun 已提交
293
{
294 295 296
  const char *value = GetBuildUser();
  printf("Build User=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
297 298 299
};

/**
M
mamingshuai 已提交
300 301
 * @tc.number    : SUB_UTILS_PARAMETER_2000
 * @tc.name      : Obtaining system parameter BuildHost
W
wenjun 已提交
302 303
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
304
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara020, Function | MediumTest | Level1)
W
wenjun 已提交
305
{
306 307 308
  const char *value = GetBuildHost();
  printf("Build Host=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
309 310 311
};

/**
M
mamingshuai 已提交
312 313
 * @tc.number    : SUB_UTILS_PARAMETER_2100
 * @tc.name      : Obtaining system parameter BuildTime
W
wenjun 已提交
314 315
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
316
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara021, Function | MediumTest | Level1)
W
wenjun 已提交
317
{
318 319 320
  const char *value = GetBuildTime();
  printf("Build Time=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
321 322 323
};

/**
M
mamingshuai 已提交
324 325
 * @tc.number    : SUB_UTILS_PARAMETER_2200
 * @tc.name      : Obtaining system parameter BuildRootHash
W
wenjun 已提交
326 327
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
328
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara022, Function | MediumTest | Level1)
W
wenjun 已提交
329
{
330 331 332
  const char *value = GetBuildRootHash();
  printf("Build Root Hash=%s\n", value);
  TEST_ASSERT_NOT_NULL(value);
W
wenjun 已提交
333 334 335
};

/**
M
mamingshuai 已提交
336 337
 * @tc.number    : SUB_UTILS_PARAMETER_2300
 * @tc.name      : Obtaining system parameter SoftwareModel
W
wenjun 已提交
338 339
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
340
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara023, Function | MediumTest | Level1)
W
wenjun 已提交
341
{
342 343 344
  const char *value = GetSoftwareModel();
  printf("Software Model=%s\n", value);
  AssertNotEmpty(value);
W
wenjun 已提交
345 346 347
};

/**
M
mamingshuai 已提交
348 349
 * @tc.number    : SUB_UTILS_PARAMETER_2400
 * @tc.name      : Obtaining system parameter SdkApiLevel
W
wenjun 已提交
350 351
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
352
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara024, Function | MediumTest | Level1)
W
wenjun 已提交
353
{
354 355 356
  int value = GetSdkApiVersion();
  printf("Sdk Api Level=%d\n", value);
  TEST_ASSERT_TRUE(value > 0);
W
wenjun 已提交
357 358 359
};

/**
M
mamingshuai 已提交
360 361
 * @tc.number    : SUB_UTILS_PARAMETER_2500
 * @tc.name      : SetParameter parameter legal test
W
wenjun 已提交
362 363
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
364
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter001, Function | MediumTest | Level1)
W
wenjun 已提交
365
{
366
  int ret;
W
wenjun 已提交
367

368 369 370 371
  char key[] = "rw.sys.version_606";
  char value[] = "OEM-10.1.0";
  ret = SetParameter(key, value);
  TEST_ASSERT_EQUAL_INT(0, ret);
W
wenjun 已提交
372 373 374
};

/**
M
mamingshuai 已提交
375 376
 * @tc.number    : SUB_UTILS_PARAMETER_2600
 * @tc.name      : SetParameter parameter legal test with Special characters
W
wenjun 已提交
377 378
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
379
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter002, Function | MediumTest | Level1)
W
wenjun 已提交
380
{
381
  int ret;
W
wenjun 已提交
382

383 384 385 386
  char key[] = "_._..__...___";
  char value[] = "!@#¥%……&*()——+~《》?,。、“‘;:、12345767890";
  ret = SetParameter(key, value);
  TEST_ASSERT_EQUAL_INT(0, ret);
W
wenjun 已提交
387 388 389
};

/**
M
mamingshuai 已提交
390 391
 * @tc.number    : SUB_UTILS_PARAMETER_2700
 * @tc.name      : SetParameter parameter legal test using key with only lowercase
W
wenjun 已提交
392 393
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
394
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter003, Function | MediumTest | Level1)
W
wenjun 已提交
395
{
396
  int ret;
W
wenjun 已提交
397

398 399 400 401
  char key[] = "keywithonlylowercase";
  char value[] = "test key with only lowercase";
  ret = SetParameter(key, value);
  TEST_ASSERT_EQUAL_INT(0, ret);
W
wenjun 已提交
402 403 404
};

/**
M
mamingshuai 已提交
405 406
 * @tc.number    : SUB_UTILS_PARAMETER_2800
 * @tc.name      : SetParameter parameter legal test using key with only number
W
wenjun 已提交
407 408
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
409
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter004, Function | MediumTest | Level1)
W
wenjun 已提交
410
{
411
  int ret;
W
wenjun 已提交
412

413 414 415 416
  char key[] = "202006060602";
  char value[] = "test key with only number";
  ret = SetParameter(key, value);
  TEST_ASSERT_EQUAL_INT(0, ret);
W
wenjun 已提交
417 418 419
};

/**
M
mamingshuai 已提交
420 421
 * @tc.number    : SUB_UTILS_PARAMETER_2900
 * @tc.name      : SetParameter parameter legal test using key and value with maximum length
W
wenjun 已提交
422 423
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
424
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter005, Function | MediumTest | Level1)
W
wenjun 已提交
425
{
426
  int ret;
W
wenjun 已提交
427

428 429 430 431
  char key1[] = "rw.sys.version.version.version.";
  char value1[] = "set with key = 31";
  ret = SetParameter(key1, value1);
  TEST_ASSERT_EQUAL_INT(0, ret);
W
wenjun 已提交
432

433 434
  char key2[] = "rw.sys.version.version";
  char value2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
W
wenjun 已提交
435
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs";
436 437
  ret = SetParameter(key2, value2);
  TEST_ASSERT_EQUAL_INT(0, ret);
W
wenjun 已提交
438 439 440
};

/**
M
mamingshuai 已提交
441 442
 * @tc.number    : SUB_UTILS_PARAMETER_3000
 * @tc.name      : SetParameter parameter illegal test when key is nullptr and value is nullptr
W
wenjun 已提交
443 444
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
445
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter006, Function | MediumTest | Level1)
W
wenjun 已提交
446
{
447
  int ret;
W
wenjun 已提交
448

449 450 451 452 453 454
  char value[] = "test with null";
  ret = SetParameter(NULL, value);
  if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
  {
    TEST_ASSERT_EQUAL_INT(1, 1);
  }
W
wenjun 已提交
455

456 457 458 459 460 461
  char key[] = "rw.sys.version";
  ret = SetParameter(key, NULL);
  if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
  {
    TEST_ASSERT_EQUAL_INT(1, 1);
  }
W
wenjun 已提交
462 463 464
};

/**
M
mamingshuai 已提交
465 466
 * @tc.number    : SUB_UTILS_PARAMETER_3100
 * @tc.name      : SetParameter parameter illegal test when key is NULL and value is NULL
W
wenjun 已提交
467 468
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
469
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter007, Function | MediumTest | Level1)
W
wenjun 已提交
470
{
471
  int ret;
W
wenjun 已提交
472

473 474 475 476 477 478
  char value[] = "test with null";
  ret = SetParameter("\0", value);
  if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
  {
    TEST_ASSERT_EQUAL_INT(1, 1);
  }
W
wenjun 已提交
479

480 481 482 483 484 485
  char key[] = "rw.sys.version";
  ret = SetParameter(key, "\0");
  if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
  {
    TEST_ASSERT_EQUAL_INT(1, 1);
  }
W
wenjun 已提交
486 487 488
};

/**
M
mamingshuai 已提交
489 490
 * @tc.number    : SUB_UTILS_PARAMETER_3200
 * @tc.name      : SetParameter parameter illegal test when key len is 32 or more than 32 bytes
W
wenjun 已提交
491 492
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
493
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter008, Function | MediumTest | Level1)
W
wenjun 已提交
494
{
495
  int ret;
W
wenjun 已提交
496

497 498 499 500 501 502 503
  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);
  }
W
wenjun 已提交
504

505 506 507 508 509 510 511
  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);
  }
W
wenjun 已提交
512 513 514
};

/**
M
mamingshuai 已提交
515 516
 * @tc.number    : SUB_UTILS_PARAMETER_3300
 * @tc.name      : SetParameter parameter illegal test using key with uppercase
W
wenjun 已提交
517 518
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
519
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter009, Function | MediumTest | Level1)
W
wenjun 已提交
520
{
521
  int ret;
W
wenjun 已提交
522

523 524 525 526 527 528 529
  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);
  }
W
wenjun 已提交
530 531 532
};

/**
M
mamingshuai 已提交
533 534
 * @tc.number    : SUB_UTILS_PARAMETER_3400
 * @tc.name      : SetParameter parameter illegal test using key with blank
W
wenjun 已提交
535 536
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
537
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter010, Function | MediumTest | Level1)
W
wenjun 已提交
538
{
539
  int ret;
W
wenjun 已提交
540

541 542 543 544 545 546 547
  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);
  }
W
wenjun 已提交
548 549 550
};

/**
M
mamingshuai 已提交
551 552
 * @tc.number    : SUB_UTILS_PARAMETER_3500
 * @tc.name      : SetParameter parameter illegal test using key with invalid special characters
W
wenjun 已提交
553 554
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
555
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter011, Function | MediumTest | Level1)
W
wenjun 已提交
556
{
557
  int ret;
W
wenjun 已提交
558

559 560 561 562 563 564 565
  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);
  }
W
wenjun 已提交
566 567 568
};

/**
M
mamingshuai 已提交
569 570
 * @tc.number    : SUB_UTILS_PARAMETER_3600
 * @tc.name      : SetParameter parameter illegal test when value length is 128 or more than 128 bytes
W
wenjun 已提交
571 572
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
573
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter012, Function | MediumTest | Level1)
W
wenjun 已提交
574
{
575
  int ret;
W
wenjun 已提交
576

577 578
  char key1[] = "rw.sys.version.version1";
  char value1[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
W
wenjun 已提交
579
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrst";
580 581 582 583 584 585 586 587
  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\
W
wenjun 已提交
588
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890";
589 590 591 592 593
  ret = SetParameter(key2, value2);
  if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
  {
    TEST_ASSERT_EQUAL_INT(1, 1);
  }
W
wenjun 已提交
594 595 596
};

/**
M
mamingshuai 已提交
597 598
 * @tc.number    : SUB_UTILS_PARAMETER_3700
 * @tc.name      : SetParameter parameter legal test when value contains only blanks
W
wenjun 已提交
599 600
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
601
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter013, Function | MediumTest | Level1)
W
wenjun 已提交
602
{
603
  int ret;
W
wenjun 已提交
604

605 606 607 608
  char key[] = "key_for_blank_value";
  char value[] = "                         ";
  ret = SetParameter(key, value);
  TEST_ASSERT_EQUAL_INT(0, ret);
W
wenjun 已提交
609 610 611
};

/**
M
mamingshuai 已提交
612 613
 * @tc.number    : SUB_UTILS_PARAMETER_3800
 * @tc.name      : GetParameter parameter legal test
W
wenjun 已提交
614 615
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
616
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter001, Function | MediumTest | Level1)
W
wenjun 已提交
617
{
618
  int ret;
W
wenjun 已提交
619

620 621 622 623 624 625 626
  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);
W
wenjun 已提交
627 628 629
};

/**
M
mamingshuai 已提交
630 631
 * @tc.number    : SUB_UTILS_PARAMETER_3900
 * @tc.name      : GetParameter parameter legal test with Special characters
W
wenjun 已提交
632 633
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
634
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter002, Function | MediumTest | Level1)
W
wenjun 已提交
635
{
636
  int ret;
W
wenjun 已提交
637

638 639 640 641 642 643 644
  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);
W
wenjun 已提交
645 646 647
};

/**
M
mamingshuai 已提交
648 649
 * @tc.number    : SUB_UTILS_PARAMETER_4000
 * @tc.name      : GetParameter parameter legal test using key with only lowercase
W
wenjun 已提交
650 651
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
652
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter003, Function | MediumTest | Level1)
W
wenjun 已提交
653
{
654
  int ret;
W
wenjun 已提交
655

656 657 658 659 660 661 662
  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);
W
wenjun 已提交
663 664 665
};

/**
M
mamingshuai 已提交
666 667
 * @tc.number    : SUB_UTILS_PARAMETER_4100
 * @tc.name      : GetParameter parameter legal test using key with only number
W
wenjun 已提交
668 669
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
670
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter004, Function | MediumTest | Level1)
W
wenjun 已提交
671
{
672
  int ret;
W
wenjun 已提交
673

674 675 676 677 678 679 680
  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);
W
wenjun 已提交
681 682 683
};

/**
M
mamingshuai 已提交
684 685
 * @tc.number    : SUB_UTILS_PARAMETER_4200
 * @tc.name      : GetParameter parameter legal test when defaut value point is nullptr
W
wenjun 已提交
686 687
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
688
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter005, Function | MediumTest | Level1)
W
wenjun 已提交
689
{
690
  int ret;
W
wenjun 已提交
691

692 693 694 695 696 697 698
  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);
W
wenjun 已提交
699 700 701
};

/**
M
mamingshuai 已提交
702 703
 * @tc.number    : SUB_UTILS_PARAMETER_4300
 * @tc.name      : GetParameter parameter legal test when the key is not exist
W
wenjun 已提交
704 705
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
706
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter006, Function | MediumTest | Level1)
W
wenjun 已提交
707
{
708
  int ret;
W
wenjun 已提交
709

710 711 712 713 714
  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);
W
wenjun 已提交
715 716 717
};

/**
M
mamingshuai 已提交
718 719
 * @tc.number    : SUB_UTILS_PARAMETER_4400
 * @tc.name      : GetParameter parameter legal test using key and value with maximum length
W
wenjun 已提交
720 721
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
722
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter007, Function | MediumTest | Level1)
W
wenjun 已提交
723
{
724
  int ret;
W
wenjun 已提交
725

726 727 728 729 730 731 732
  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);
W
wenjun 已提交
733

734 735
  char key2[] = "rw.sys.version.version";
  char rightVal2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
W
wenjun 已提交
736
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs";
737 738 739 740 741
  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);
W
wenjun 已提交
742 743 744
};

/**
M
mamingshuai 已提交
745 746
 * @tc.number    : SUB_UTILS_PARAMETER_4500
 * @tc.name      : GetParameter parameter illegal test with invalid value length
W
wenjun 已提交
747 748
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
749
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter008, Function | MediumTest | Level1)
W
wenjun 已提交
750
{
751
  int ret;
W
wenjun 已提交
752

753 754 755 756 757 758 759 760 761
  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);
  }
W
wenjun 已提交
762 763 764
};

/**
M
mamingshuai 已提交
765 766
 * @tc.number    : SUB_UTILS_PARAMETER_4600
 * @tc.name      : GetParameter parameter illegal test when value point is nullptr
W
wenjun 已提交
767 768
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
769
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter009, Function | MediumTest | Level1)
W
wenjun 已提交
770
{
771
  int ret;
W
wenjun 已提交
772

773 774 775 776 777 778 779 780
  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);
  }
W
wenjun 已提交
781 782 783
};

/**
M
mamingshuai 已提交
784 785
 * @tc.number    : SUB_UTILS_PARAMETER_4700
 * @tc.name      : GetParameter parameter illegal test when key is not exist and value len is invalid
W
wenjun 已提交
786 787
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
788
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter010, Function | MediumTest | Level1)
W
wenjun 已提交
789
{
790
  int ret;
W
wenjun 已提交
791

792 793 794 795
  char key[] = "none.exist.key";
  char value[INVALID_LEN] = {0};
  ret = GetParameter(key, g_defSysParam, value, INVALID_LEN);
  TEST_ASSERT_EQUAL_INT(-1, ret);
W
wenjun 已提交
796 797 798
};

/**
M
mamingshuai 已提交
799 800
 * @tc.number    : SUB_UTILS_PARAMETER_4800
 * @tc.name      : GetParameter parameter illegal test when key is not exist and defaut value point is nullptr
W
wenjun 已提交
801 802
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
803
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter011, Function | MediumTest | Level1)
W
wenjun 已提交
804
{
805
  int ret;
W
wenjun 已提交
806

807 808 809 810
  char key[] = "none.exist.key";
  char value[MAX_LEN] = {0};
  ret = GetParameter(key, NULL, value, MAX_LEN);
  TEST_ASSERT_EQUAL_INT(-1, ret);
W
wenjun 已提交
811 812 813
};

/**
M
mamingshuai 已提交
814 815
 * @tc.number    : SUB_UTILS_PARAMETER_4900
 * @tc.name      : GetParameter parameter illegal test when key len is 32 bytes
W
wenjun 已提交
816 817
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
818
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter012, Function | MediumTest | Level1)
W
wenjun 已提交
819
{
820
  int ret;
W
wenjun 已提交
821

822 823 824 825 826 827 828
  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);
  }
W
wenjun 已提交
829 830 831
};

/**
M
mamingshuai 已提交
832 833
 * @tc.number    : SUB_UTILS_PARAMETER_5000
 * @tc.name      : GetParameter parameter illegal test when key len is more than 32 bytes
W
wenjun 已提交
834 835
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
836
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter013, Function | MediumTest | Level1)
W
wenjun 已提交
837
{
838
  int ret;
W
wenjun 已提交
839

840 841 842 843 844 845 846
  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);
  }
W
wenjun 已提交
847 848 849
};

/**
M
mamingshuai 已提交
850 851
 * @tc.number    : SUB_UTILS_PARAMETER_5100
 * @tc.name      : GetParameter parameter illegal test when key is nullptr
W
wenjun 已提交
852 853
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
854
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter014, Function | MediumTest | Level1)
W
wenjun 已提交
855
{
856
  int ret;
W
wenjun 已提交
857

858 859 860 861 862 863
  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);
  }
W
wenjun 已提交
864 865 866
};

/**
M
mamingshuai 已提交
867 868
 * @tc.number    : SUB_UTILS_PARAMETER_5200
 * @tc.name      : GetParameter parameter illegal test using key with uppercase
W
wenjun 已提交
869 870
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
871
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter015, Function | MediumTest | Level1)
W
wenjun 已提交
872
{
873
  int ret;
W
wenjun 已提交
874

875 876 877 878 879 880 881
  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);
  }
W
wenjun 已提交
882 883 884
};

/**
M
mamingshuai 已提交
885 886
 * @tc.number    : SUB_UTILS_PARAMETER_5300
 * @tc.name      : GetParameter parameter illegal test using key with blank
W
wenjun 已提交
887 888
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
889
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter016, Function | MediumTest | Level1)
W
wenjun 已提交
890
{
891
  int ret;
W
wenjun 已提交
892

893 894 895 896 897 898 899
  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);
  }
W
wenjun 已提交
900 901 902
};

/**
M
mamingshuai 已提交
903 904
 * @tc.number    : SUB_UTILS_PARAMETER_5400
 * @tc.name      : GetParameter parameter illegal test using key with invalid special characters
W
wenjun 已提交
905 906
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
907
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter017, Function | MediumTest | Level1)
W
wenjun 已提交
908
{
909
  int ret;
W
wenjun 已提交
910

911 912 913 914 915 916 917
  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);
  }
W
wenjun 已提交
918 919 920
};

/**
M
mamingshuai 已提交
921 922
 * @tc.number    : SUB_UTILS_PARAMETER_5500
 * @tc.name      : GetParameter parameter illegal test when key is NULL
W
wenjun 已提交
923 924
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
925
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter018, Function | MediumTest | Level1)
W
wenjun 已提交
926
{
927
  int ret;
W
wenjun 已提交
928

929 930 931 932 933 934
  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);
  }
W
wenjun 已提交
935 936 937
};

/**
M
mamingshuai 已提交
938 939
 * @tc.number    : SUB_UTILS_PARAMETER_5600
 * @tc.name      : GetParameter parameter legal test when value contains only blanks
W
wenjun 已提交
940 941
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
942
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter019, Function | MediumTest | Level1)
W
wenjun 已提交
943
{
944
  int ret;
W
wenjun 已提交
945

946 947 948 949 950 951 952
  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);
W
wenjun 已提交
953 954 955
};

/**
M
mamingshuai 已提交
956
 * @tc.number    : SUB_UTILS_PARAMETER_5700
W
wenjun 已提交
957 958 959
 * @tc.name      : Update value of parameter legal test
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
960
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter020, Function | MediumTest | Level1)
W
wenjun 已提交
961
{
962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979
  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);
W
wenjun 已提交
980 981 982
};

RUN_TEST_SUITE(ParameterFuncTestSuite);