parameter_func_test.c 29.6 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 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
#include <securec.h>
#include "hctest.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 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)
{
    return TRUE;
}

/**
 * @tc.teardown  : teardown for all testcases
 * @return       : teardown result, TRUE is success, FALSE is fail
 */
static BOOL ParameterFuncTestSuiteTearDown(void)
{
    printf("+-------------------------------------------+\n");
    return TRUE;
}

/**
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
{
L
lanxueyuan 已提交
63
    const char* value = GetDeviceType();
64
    printf("Device Type=%s\n", value);
65
    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
{
L
lanxueyuan 已提交
75
    const char* value = GetManufacture();
W
wenjun 已提交
76
    printf("Manufacture=%s\n", value);
77
    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
{
L
lanxueyuan 已提交
87
    const char* value = GetBrand();
W
wenjun 已提交
88
    printf("Brand=%s\n", value);
89
    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
{
L
lanxueyuan 已提交
99
    const char* value = GetMarketName();
W
wenjun 已提交
100
    printf("Market Name=%s\n", value);
101
    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
{
L
lanxueyuan 已提交
111
    const char* value = GetProductSeries();
W
wenjun 已提交
112
    printf("Product Series=%s\n", value);
113
    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
{
L
lanxueyuan 已提交
123
    const char* value = GetProductModel();
W
wenjun 已提交
124
    printf("Product Model=%s\n", value);
125
    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
{
L
lanxueyuan 已提交
135
    const char* value = GetHardwareModel();
W
wenjun 已提交
136
    printf("Hardware Model=%s\n", value);
137
    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
{
L
lanxueyuan 已提交
147
    const char* value = GetHardwareProfile();
W
wenjun 已提交
148
    printf("Hardware Profile=%s\n", value);
149
    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
{
L
lanxueyuan 已提交
159
    const char* value = GetSerial();
W
wenjun 已提交
160
    printf("Serial=%s\n", value);
161
    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
{
L
lanxueyuan 已提交
171
    const char* value = GetOSFullName();
W
wenjun 已提交
172
    printf("Os Name=%s\n", value);
173
    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
{
L
lanxueyuan 已提交
183
    const char* value = GetDisplayVersion();
W
wenjun 已提交
184
    printf("Display Version=%s\n", value);
185
    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
{
L
lanxueyuan 已提交
195
    const char* value = GetBootloaderVersion();
W
wenjun 已提交
196
    printf("Bootloader Version=%s\n", value);
197
    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
{
L
lanxueyuan 已提交
207
    const char* value = GetSecurityPatchTag();
W
wenjun 已提交
208
    printf("Secure Patch Level=%s\n", value);
209
    AssertNotEmpty(value);
W
wenjun 已提交
210 211
};

212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
/**
 * @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 已提交
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
{
L
lanxueyuan 已提交
234
    const char* value = GetAbiList();
W
wenjun 已提交
235
    printf("Abi List=%s\n", value);
236
    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
{
L
lanxueyuan 已提交
246 247
    int value = GetFirstApiVersion();
    printf("First Api Level=%d\n", value);
248
    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
{
L
lanxueyuan 已提交
258
    const char* value = GetIncrementalVersion();
W
wenjun 已提交
259
    printf("Incremental Version=%s\n", value);
260
    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
{
L
lanxueyuan 已提交
270
    const char* value = GetVersionId();
W
wenjun 已提交
271
    printf("Version Id=%s\n", value);
272
    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
{
L
lanxueyuan 已提交
282
    const char* value = GetBuildType();
W
wenjun 已提交
283
    printf("Build Type=%s\n", value);
284
    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
{
L
lanxueyuan 已提交
294
    const char* value = GetBuildUser();
W
wenjun 已提交
295
    printf("Build User=%s\n", value);
296
    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
{
L
lanxueyuan 已提交
306
    const char* value = GetBuildHost();
W
wenjun 已提交
307
    printf("Build Host=%s\n", value);
308
    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
{
L
lanxueyuan 已提交
318
    const char* value = GetBuildTime();
W
wenjun 已提交
319
    printf("Build Time=%s\n", value);
320
    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
{
L
lanxueyuan 已提交
330
    const char* value = GetBuildRootHash();
W
wenjun 已提交
331
    printf("Build Root Hash=%s\n", value);
332
    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
{
L
lanxueyuan 已提交
342
    const char* value = GetSoftwareModel();
W
wenjun 已提交
343
    printf("Software Model=%s\n", value);
344
    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
{
L
lanxueyuan 已提交
354 355
    int value = GetSdkApiVersion();
    printf("Sdk Api Level=%d\n", value);
356
    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 367 368
{
    int ret;

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

/**
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 382 383 384 385 386 387 388 389
{
    int ret;

    char key[] = "_._..__...___";
    char value[] = "!@#¥%……&*()——+~《》?,。、“‘;:、12345767890";
    ret = SetParameter(key, value);
    TEST_ASSERT_EQUAL_INT(0, ret);
};

/**
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 397 398 399 400 401 402 403 404
{
    int ret;

    char key[] = "keywithonlylowercase";
    char value[] = "test key with only lowercase";
    ret = SetParameter(key, value);
    TEST_ASSERT_EQUAL_INT(0, ret);
};

/**
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 412 413 414 415 416 417 418 419
{
    int ret;

    char key[] = "202006060602";
    char value[] = "test key with only number";
    ret = SetParameter(key, value);
    TEST_ASSERT_EQUAL_INT(0, ret);
};

/**
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 427 428 429 430 431 432 433 434 435 436 437 438 439 440
{
    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 key2[] = "rw.sys.version.version";
    char value2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrs";
    ret = SetParameter(key2, value2);
    TEST_ASSERT_EQUAL_INT(0, ret);
};

/**
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 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464
{
    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 key[] = "rw.sys.version";
    ret = SetParameter(key, NULL);
    if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
    {
        TEST_ASSERT_EQUAL_INT(1, 1);
    }
};

/**
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 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488
{
    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 key[] = "rw.sys.version";
    ret = SetParameter(key, "\0");
    if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
    {
        TEST_ASSERT_EQUAL_INT(1, 1);
    }
};

/**
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 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514
{
    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 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);
    }
};

/**
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 522 523 524 525 526 527 528 529 530 531 532
{
    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);
    }
};

/**
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 540 541 542 543 544 545 546 547 548 549 550
{
    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);
    }
};

/**
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 558 559 560 561 562 563 564 565 566 567 568
{
    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);
    }
};

/**
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 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596
{
    int ret;

    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\
abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890";
    ret = SetParameter(key2, value2);
    if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
    {
        TEST_ASSERT_EQUAL_INT(1, 1);
    }
};

/**
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 604 605 606 607 608 609 610 611
{
    int ret;

    char key[] = "key_for_blank_value";
    char value[] = "                         ";
    ret = SetParameter(key, value);
    TEST_ASSERT_EQUAL_INT(0, ret);
};

/**
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 619 620
{
    int ret;

    char key[] = "rw.sys.version_606";
M
mamingshuai 已提交
621
    char rightVal[] = "OEM-10.1.0";
W
wenjun 已提交
622 623 624 625
    char value[MAX_LEN] = {0};
    SetParameter(key, rightVal);
    ret = GetParameter(key, g_defSysParam, value, MAX_LEN);
    TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
M
mamingshuai 已提交
626
    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 637 638 639 640 641 642 643
{
    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);
M
mamingshuai 已提交
644
    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 655 656 657 658 659 660 661
{
    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);
M
mamingshuai 已提交
662
    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 673 674 675 676 677 678 679
{
    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);
M
mamingshuai 已提交
680
    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 691 692
{
    int ret;

    char key[] = "rw.sys.version_606";
M
mamingshuai 已提交
693
    char rightVal[] = "OEM-10.1.0";
W
wenjun 已提交
694 695 696 697
    char value[MAX_LEN] = {0};
    SetParameter(key, rightVal);
    ret = GetParameter(key, NULL, value, MAX_LEN);
    TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
M
mamingshuai 已提交
698
    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 709 710 711 712 713
{
    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);
M
mamingshuai 已提交
714
    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 725 726 727 728 729 730 731
{
    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);
M
mamingshuai 已提交
732
    TEST_ASSERT_EQUAL_STRING(rightVal1, value1);
W
wenjun 已提交
733 734 735 736 737 738 739 740

    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);
M
mamingshuai 已提交
741
    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 752 753
{
    int ret;

    char key[] = "rw.sys.version_606";
M
mamingshuai 已提交
754
    char rightVal[] = "OEM-10.1.0";
W
wenjun 已提交
755 756 757 758 759 760 761 762 763 764
    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);
    }
};

/**
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 772 773
{
    int ret;

    char key[] = "rw.sys.version_606";
M
mamingshuai 已提交
774
    char rightVal[] = "OEM-10.1.0";
W
wenjun 已提交
775 776 777 778 779 780 781 782 783
    SetParameter(key, rightVal);
    ret = GetParameter(key, g_defSysParam, NULL, MAX_LEN);
    if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER))
    {
        TEST_ASSERT_EQUAL_INT(1, 1);
    }
};

/**
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 791 792 793 794 795 796 797 798
{
    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);
};

/**
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 806 807 808 809 810 811 812 813
{
    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);
};

/**
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 821 822 823 824 825 826 827 828 829 830 831
{
    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);
    }
};

/**
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 839 840 841 842 843 844 845 846 847 848 849
{
    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);
    }
};

/**
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 857 858 859 860 861 862 863 864 865 866
{
    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);
    }
};

/**
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 874 875 876 877 878 879 880 881 882 883 884
{
    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);
    }
};

/**
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 892 893 894 895 896 897 898 899 900 901 902
{
    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);
    }
};

/**
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 910 911 912 913 914 915 916 917 918 919 920
{
    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);
    }
};

/**
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 928 929 930 931 932 933 934 935 936 937
{
    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);
    }
};

/**
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 945 946 947 948 949 950 951
{
    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);
M
mamingshuai 已提交
952
    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
{
    int ret;

    char key[] = "rw.sys.version_606";
M
mamingshuai 已提交
965
    char rightVal1[] = "OEM-10.1.0";
W
wenjun 已提交
966 967 968 969 970
    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);
M
mamingshuai 已提交
971
    TEST_ASSERT_EQUAL_STRING(rightVal1, value1);
W
wenjun 已提交
972

M
mamingshuai 已提交
973
    char rightVal2[] = "update the value of OEM-10.1.0";
W
wenjun 已提交
974 975 976 977 978
    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);
M
mamingshuai 已提交
979
    TEST_ASSERT_EQUAL_STRING(rightVal2, value2);
W
wenjun 已提交
980 981 982
};

RUN_TEST_SUITE(ParameterFuncTestSuite);