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
};

J
jiyong_sd 已提交
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
/**
 * @tc.number    : SUB_UTILS_PARAMETER_8200
 * @tc.name      : Obtaining system parameter SecurityPatchTag which format is yy--mm--dd
 * @tc.desc      : [C- SOFTWARE -0200]
 */
LITE_TEST_CASE(ParameterFuncTestSuite, testGetSecurityPatchTag02, Function | MediumTest | Level1)
{
    const char *value = GetSecurityPatchTag();
    printf("Secure Patch Level=%s\n", value);
    int year, month, day;

    sscanf(value, "%04d-%02d-%02d", &year, &month, &day);
    printf("%d-%02d-%02d\n", year, month, day);
    char *str = ("%d-%02d-%02d\n", year, month, day);
    TEST_ONLY();
};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/**
M
mamingshuai 已提交
422 423
 * @tc.number    : SUB_UTILS_PARAMETER_2900
 * @tc.name      : SetParameter parameter legal test using key and value with maximum length
W
wenjun 已提交
424 425
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
426
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter005, Function | MediumTest | Level1)
W
wenjun 已提交
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442
{
    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 已提交
443 444
 * @tc.number    : SUB_UTILS_PARAMETER_3000
 * @tc.name      : SetParameter parameter illegal test when key is nullptr and value is nullptr
W
wenjun 已提交
445 446
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
447
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter006, Function | MediumTest | Level1)
W
wenjun 已提交
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466
{
    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 已提交
467 468
 * @tc.number    : SUB_UTILS_PARAMETER_3100
 * @tc.name      : SetParameter parameter illegal test when key is NULL and value is NULL
W
wenjun 已提交
469 470
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
471
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter007, Function | MediumTest | Level1)
W
wenjun 已提交
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
{
    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 已提交
491 492
 * @tc.number    : SUB_UTILS_PARAMETER_3200
 * @tc.name      : SetParameter parameter illegal test when key len is 32 or more than 32 bytes
W
wenjun 已提交
493 494
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
495
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter008, Function | MediumTest | Level1)
W
wenjun 已提交
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516
{
    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 已提交
517 518
 * @tc.number    : SUB_UTILS_PARAMETER_3300
 * @tc.name      : SetParameter parameter illegal test using key with uppercase
W
wenjun 已提交
519 520
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
521
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter009, Function | MediumTest | Level1)
W
wenjun 已提交
522 523 524 525 526 527 528 529 530 531 532 533 534
{
    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 已提交
535 536
 * @tc.number    : SUB_UTILS_PARAMETER_3400
 * @tc.name      : SetParameter parameter illegal test using key with blank
W
wenjun 已提交
537 538
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
539
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter010, Function | MediumTest | Level1)
W
wenjun 已提交
540 541 542 543 544 545 546 547 548 549 550 551 552
{
    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 已提交
553 554
 * @tc.number    : SUB_UTILS_PARAMETER_3500
 * @tc.name      : SetParameter parameter illegal test using key with invalid special characters
W
wenjun 已提交
555 556
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
557
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter011, Function | MediumTest | Level1)
W
wenjun 已提交
558 559 560 561 562 563 564 565 566 567 568 569 570
{
    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 已提交
571 572
 * @tc.number    : SUB_UTILS_PARAMETER_3600
 * @tc.name      : SetParameter parameter illegal test when value length is 128 or more than 128 bytes
W
wenjun 已提交
573 574
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
575
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter012, Function | MediumTest | Level1)
W
wenjun 已提交
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598
{
    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 已提交
599 600
 * @tc.number    : SUB_UTILS_PARAMETER_3700
 * @tc.name      : SetParameter parameter legal test when value contains only blanks
W
wenjun 已提交
601 602
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
603
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter013, Function | MediumTest | Level1)
W
wenjun 已提交
604 605 606 607 608 609 610 611 612 613
{
    int ret;

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

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

    char key[] = "rw.sys.version_606";
M
mamingshuai 已提交
623
    char rightVal[] = "OEM-10.1.0";
W
wenjun 已提交
624 625 626 627
    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 已提交
628
    TEST_ASSERT_EQUAL_STRING(rightVal, value);
W
wenjun 已提交
629 630 631
};

/**
M
mamingshuai 已提交
632 633
 * @tc.number    : SUB_UTILS_PARAMETER_3900
 * @tc.name      : GetParameter parameter legal test with Special characters
W
wenjun 已提交
634 635
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
636
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter002, Function | MediumTest | Level1)
W
wenjun 已提交
637 638 639 640 641 642 643 644 645
{
    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 已提交
646
    TEST_ASSERT_EQUAL_STRING(rightVal, value);
W
wenjun 已提交
647 648 649
};

/**
M
mamingshuai 已提交
650 651
 * @tc.number    : SUB_UTILS_PARAMETER_4000
 * @tc.name      : GetParameter parameter legal test using key with only lowercase
W
wenjun 已提交
652 653
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
654
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter003, Function | MediumTest | Level1)
W
wenjun 已提交
655 656 657 658 659 660 661 662 663
{
    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 已提交
664
    TEST_ASSERT_EQUAL_STRING(rightVal, value);
W
wenjun 已提交
665 666 667
};

/**
M
mamingshuai 已提交
668 669
 * @tc.number    : SUB_UTILS_PARAMETER_4100
 * @tc.name      : GetParameter parameter legal test using key with only number
W
wenjun 已提交
670 671
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
672
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter004, Function | MediumTest | Level1)
W
wenjun 已提交
673 674 675 676 677 678 679 680 681
{
    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 已提交
682
    TEST_ASSERT_EQUAL_STRING(rightVal, value);
W
wenjun 已提交
683 684 685
};

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

    char key[] = "rw.sys.version_606";
M
mamingshuai 已提交
695
    char rightVal[] = "OEM-10.1.0";
W
wenjun 已提交
696 697 698 699
    char value[MAX_LEN] = {0};
    SetParameter(key, rightVal);
    ret = GetParameter(key, NULL, value, MAX_LEN);
    TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
M
mamingshuai 已提交
700
    TEST_ASSERT_EQUAL_STRING(rightVal, value);
W
wenjun 已提交
701 702 703
};

/**
M
mamingshuai 已提交
704 705
 * @tc.number    : SUB_UTILS_PARAMETER_4300
 * @tc.name      : GetParameter parameter legal test when the key is not exist
W
wenjun 已提交
706 707
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
708
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter006, Function | MediumTest | Level1)
W
wenjun 已提交
709 710 711 712 713 714 715
{
    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 已提交
716
    TEST_ASSERT_EQUAL_STRING(g_defSysParam, value);
W
wenjun 已提交
717 718 719
};

/**
M
mamingshuai 已提交
720 721
 * @tc.number    : SUB_UTILS_PARAMETER_4400
 * @tc.name      : GetParameter parameter legal test using key and value with maximum length
W
wenjun 已提交
722 723
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
724
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter007, Function | MediumTest | Level1)
W
wenjun 已提交
725 726 727 728 729 730 731 732 733
{
    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 已提交
734
    TEST_ASSERT_EQUAL_STRING(rightVal1, value1);
W
wenjun 已提交
735 736 737 738 739 740 741 742

    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 已提交
743
    TEST_ASSERT_EQUAL_STRING(rightVal2, value2);
W
wenjun 已提交
744 745 746
};

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

    char key[] = "rw.sys.version_606";
M
mamingshuai 已提交
756
    char rightVal[] = "OEM-10.1.0";
W
wenjun 已提交
757 758 759 760 761 762 763 764 765 766
    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 已提交
767 768
 * @tc.number    : SUB_UTILS_PARAMETER_4600
 * @tc.name      : GetParameter parameter illegal test when value point is nullptr
W
wenjun 已提交
769 770
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
771
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter009, Function | MediumTest | Level1)
W
wenjun 已提交
772 773 774 775
{
    int ret;

    char key[] = "rw.sys.version_606";
M
mamingshuai 已提交
776
    char rightVal[] = "OEM-10.1.0";
W
wenjun 已提交
777 778 779 780 781 782 783 784 785
    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 已提交
786 787
 * @tc.number    : SUB_UTILS_PARAMETER_4700
 * @tc.name      : GetParameter parameter illegal test when key is not exist and value len is invalid
W
wenjun 已提交
788 789
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
790
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter010, Function | MediumTest | Level1)
W
wenjun 已提交
791 792 793 794 795 796 797 798 799 800
{
    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 已提交
801 802
 * @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 已提交
803 804
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
805
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter011, Function | MediumTest | Level1)
W
wenjun 已提交
806 807 808 809 810 811 812 813 814 815
{
    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 已提交
816 817
 * @tc.number    : SUB_UTILS_PARAMETER_4900
 * @tc.name      : GetParameter parameter illegal test when key len is 32 bytes
W
wenjun 已提交
818 819
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
820
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter012, Function | MediumTest | Level1)
W
wenjun 已提交
821 822 823 824 825 826 827 828 829 830 831 832 833
{
    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 已提交
834 835
 * @tc.number    : SUB_UTILS_PARAMETER_5000
 * @tc.name      : GetParameter parameter illegal test when key len is more than 32 bytes
W
wenjun 已提交
836 837
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
838
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter013, Function | MediumTest | Level1)
W
wenjun 已提交
839 840 841 842 843 844 845 846 847 848 849 850 851
{
    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 已提交
852 853
 * @tc.number    : SUB_UTILS_PARAMETER_5100
 * @tc.name      : GetParameter parameter illegal test when key is nullptr
W
wenjun 已提交
854 855
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
856
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter014, Function | MediumTest | Level1)
W
wenjun 已提交
857 858 859 860 861 862 863 864 865 866 867 868
{
    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 已提交
869 870
 * @tc.number    : SUB_UTILS_PARAMETER_5200
 * @tc.name      : GetParameter parameter illegal test using key with uppercase
W
wenjun 已提交
871 872
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
873
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter015, Function | MediumTest | Level1)
W
wenjun 已提交
874 875 876 877 878 879 880 881 882 883 884 885 886
{
    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 已提交
887 888
 * @tc.number    : SUB_UTILS_PARAMETER_5300
 * @tc.name      : GetParameter parameter illegal test using key with blank
W
wenjun 已提交
889 890
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
891
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter016, Function | MediumTest | Level1)
W
wenjun 已提交
892 893 894 895 896 897 898 899 900 901 902 903 904
{
    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 已提交
905 906
 * @tc.number    : SUB_UTILS_PARAMETER_5400
 * @tc.name      : GetParameter parameter illegal test using key with invalid special characters
W
wenjun 已提交
907 908
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
909
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter017, Function | MediumTest | Level1)
W
wenjun 已提交
910 911 912 913 914 915 916 917 918 919 920 921 922
{
    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 已提交
923 924
 * @tc.number    : SUB_UTILS_PARAMETER_5500
 * @tc.name      : GetParameter parameter illegal test when key is NULL
W
wenjun 已提交
925 926
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
927
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter018, Function | MediumTest | Level1)
W
wenjun 已提交
928 929 930 931 932 933 934 935 936 937 938 939
{
    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 已提交
940 941
 * @tc.number    : SUB_UTILS_PARAMETER_5600
 * @tc.name      : GetParameter parameter legal test when value contains only blanks
W
wenjun 已提交
942 943
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
944
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter019, Function | MediumTest | Level1)
W
wenjun 已提交
945 946 947 948 949 950 951 952 953
{
    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 已提交
954
    TEST_ASSERT_EQUAL_STRING(rightVal, value);
W
wenjun 已提交
955 956 957
};

/**
M
mamingshuai 已提交
958
 * @tc.number    : SUB_UTILS_PARAMETER_5700
W
wenjun 已提交
959 960 961
 * @tc.name      : Update value of parameter legal test
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
962
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter020, Function | MediumTest | Level1)
W
wenjun 已提交
963 964 965 966
{
    int ret;

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

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

RUN_TEST_SUITE(ParameterFuncTestSuite);