parameter_func_test.c 29.0 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);
W
wenjun 已提交
65 66 67 68
    IsEmpty(value);
};

/**
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 77 78 79 80
    printf("Manufacture=%s\n", value);
    IsEmpty(value);
};

/**
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 89 90 91 92
    printf("Brand=%s\n", value);
    IsEmpty(value);
};

/**
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 101 102 103 104
    printf("Market Name=%s\n", value);
    IsEmpty(value);
};

/**
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 113 114 115 116
    printf("Product Series=%s\n", value);
    IsEmpty(value);
};

/**
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 125 126 127 128
    printf("Product Model=%s\n", value);
    IsEmpty(value);
};

/**
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 137 138 139 140
    printf("Hardware Model=%s\n", value);
    IsEmpty(value);
};

/**
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 149 150 151 152
    printf("Hardware Profile=%s\n", value);
    IsEmpty(value);
};

/**
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
    IsEmpty(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 173 174 175 176
    printf("Os Name=%s\n", value);
    IsEmpty(value);
};

/**
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 185 186 187 188
    printf("Display Version=%s\n", value);
    IsEmpty(value);
};

/**
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 197 198 199 200
    printf("Bootloader Version=%s\n", value);
    IsEmpty(value);
};

/**
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 209 210 211 212
    printf("Secure Patch Level=%s\n", value);
    IsEmpty(value);
};

/**
M
mamingshuai 已提交
213 214
 * @tc.number    : SUB_UTILS_PARAMETER_1400
 * @tc.name      : Obtaining system parameter AbiList
W
wenjun 已提交
215 216
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
217
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara014, Function | MediumTest | Level1)
W
wenjun 已提交
218
{
L
lanxueyuan 已提交
219
    const char* value = GetAbiList();
W
wenjun 已提交
220 221 222 223 224
    printf("Abi List=%s\n", value);
    IsEmpty(value);
};

/**
M
mamingshuai 已提交
225 226
 * @tc.number    : SUB_UTILS_PARAMETER_1500
 * @tc.name      : Obtaining system parameter FirstApiLevel
W
wenjun 已提交
227 228
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
229
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara015, Function | MediumTest | Level1)
W
wenjun 已提交
230
{
L
lanxueyuan 已提交
231 232
    int value = GetFirstApiVersion();
    printf("First Api Level=%d\n", value);
233 234
    TEST_ASSERT_NOT_NULL(value);
    TEST_ASSERT_TRUE((int)value == value);
W
wenjun 已提交
235 236 237
};

/**
M
mamingshuai 已提交
238 239
 * @tc.number    : SUB_UTILS_PARAMETER_1600
 * @tc.name      : Obtaining system parameter IncrementalVersion
W
wenjun 已提交
240 241
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
242
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara016, Function | MediumTest | Level1)
W
wenjun 已提交
243
{
L
lanxueyuan 已提交
244
    const char* value = GetIncrementalVersion();
W
wenjun 已提交
245 246 247 248 249
    printf("Incremental Version=%s\n", value);
    IsEmpty(value);
};

/**
M
mamingshuai 已提交
250 251
 * @tc.number    : SUB_UTILS_PARAMETER_1700
 * @tc.name      : Obtaining system parameter VersionId
W
wenjun 已提交
252 253
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
254
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara017, Function | MediumTest | Level1)
W
wenjun 已提交
255
{
L
lanxueyuan 已提交
256
    const char* value = GetVersionId();
W
wenjun 已提交
257 258 259 260 261
    printf("Version Id=%s\n", value);
    IsEmpty(value);
};

/**
M
mamingshuai 已提交
262 263
 * @tc.number    : SUB_UTILS_PARAMETER_1800
 * @tc.name      : Obtaining system parameter BuildType
W
wenjun 已提交
264 265
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
266
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara018, Function | MediumTest | Level1)
W
wenjun 已提交
267
{
L
lanxueyuan 已提交
268
    const char* value = GetBuildType();
W
wenjun 已提交
269 270 271 272 273
    printf("Build Type=%s\n", value);
    IsEmpty(value);
};

/**
M
mamingshuai 已提交
274 275
 * @tc.number    : SUB_UTILS_PARAMETER_1900
 * @tc.name      : Obtaining system parameter BuildUser
W
wenjun 已提交
276 277
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
278
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara019, Function | MediumTest | Level1)
W
wenjun 已提交
279
{
L
lanxueyuan 已提交
280
    const char* value = GetBuildUser();
W
wenjun 已提交
281 282 283 284 285
    printf("Build User=%s\n", value);
    IsEmpty(value);
};

/**
M
mamingshuai 已提交
286 287
 * @tc.number    : SUB_UTILS_PARAMETER_2000
 * @tc.name      : Obtaining system parameter BuildHost
W
wenjun 已提交
288 289
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
290
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara020, Function | MediumTest | Level1)
W
wenjun 已提交
291
{
L
lanxueyuan 已提交
292
    const char* value = GetBuildHost();
W
wenjun 已提交
293 294 295 296 297
    printf("Build Host=%s\n", value);
    IsEmpty(value);
};

/**
M
mamingshuai 已提交
298 299
 * @tc.number    : SUB_UTILS_PARAMETER_2100
 * @tc.name      : Obtaining system parameter BuildTime
W
wenjun 已提交
300 301
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
302
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara021, Function | MediumTest | Level1)
W
wenjun 已提交
303
{
L
lanxueyuan 已提交
304
    const char* value = GetBuildTime();
W
wenjun 已提交
305 306 307 308 309
    printf("Build Time=%s\n", value);
    IsEmpty(value);
};

/**
M
mamingshuai 已提交
310 311
 * @tc.number    : SUB_UTILS_PARAMETER_2200
 * @tc.name      : Obtaining system parameter BuildRootHash
W
wenjun 已提交
312 313
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
314
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara022, Function | MediumTest | Level1)
W
wenjun 已提交
315
{
L
lanxueyuan 已提交
316
    const char* value = GetBuildRootHash();
W
wenjun 已提交
317 318 319 320 321
    printf("Build Root Hash=%s\n", value);
    IsEmpty(value);
};

/**
M
mamingshuai 已提交
322 323
 * @tc.number    : SUB_UTILS_PARAMETER_2300
 * @tc.name      : Obtaining system parameter SoftwareModel
W
wenjun 已提交
324 325
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
326
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara023, Function | MediumTest | Level1)
W
wenjun 已提交
327
{
L
lanxueyuan 已提交
328
    const char* value = GetSoftwareModel();
W
wenjun 已提交
329 330 331 332 333
    printf("Software Model=%s\n", value);
    IsEmpty(value);
};

/**
M
mamingshuai 已提交
334 335
 * @tc.number    : SUB_UTILS_PARAMETER_2400
 * @tc.name      : Obtaining system parameter SdkApiLevel
W
wenjun 已提交
336 337
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
338
LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara024, Function | MediumTest | Level1)
W
wenjun 已提交
339
{
L
lanxueyuan 已提交
340 341
    int value = GetSdkApiVersion();
    printf("Sdk Api Level=%d\n", value);
342 343
    TEST_ASSERT_NOT_NULL(value);
    TEST_ASSERT_TRUE((int)value == value);
W
wenjun 已提交
344 345 346
};

/**
M
mamingshuai 已提交
347 348
 * @tc.number    : SUB_UTILS_PARAMETER_2500
 * @tc.name      : SetParameter parameter legal test
W
wenjun 已提交
349 350
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
351
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter001, Function | MediumTest | Level1)
W
wenjun 已提交
352 353 354 355
{
    int ret;

    char key[] = "rw.sys.version_606";
M
mamingshuai 已提交
356
    char value[] = "OEM-10.1.0";
W
wenjun 已提交
357 358 359 360 361
    ret = SetParameter(key, value);
    TEST_ASSERT_EQUAL_INT(0, ret);
};

/**
M
mamingshuai 已提交
362 363
 * @tc.number    : SUB_UTILS_PARAMETER_2600
 * @tc.name      : SetParameter parameter legal test with Special characters
W
wenjun 已提交
364 365
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
366
LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter002, Function | MediumTest | Level1)
W
wenjun 已提交
367 368 369 370 371 372 373 374 375 376
{
    int ret;

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

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

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

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

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

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

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

/**
M
mamingshuai 已提交
599 600
 * @tc.number    : SUB_UTILS_PARAMETER_3800
 * @tc.name      : GetParameter parameter legal test
W
wenjun 已提交
601 602
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
603
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter001, Function | MediumTest | Level1)
W
wenjun 已提交
604 605 606 607
{
    int ret;

    char key[] = "rw.sys.version_606";
M
mamingshuai 已提交
608
    char rightVal[] = "OEM-10.1.0";
W
wenjun 已提交
609 610 611 612
    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 已提交
613
    TEST_ASSERT_EQUAL_STRING(rightVal, value);
W
wenjun 已提交
614 615 616
};

/**
M
mamingshuai 已提交
617 618
 * @tc.number    : SUB_UTILS_PARAMETER_3900
 * @tc.name      : GetParameter parameter legal test with Special characters
W
wenjun 已提交
619 620
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
621
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter002, Function | MediumTest | Level1)
W
wenjun 已提交
622 623 624 625 626 627 628 629 630
{
    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 已提交
631
    TEST_ASSERT_EQUAL_STRING(rightVal, value);
W
wenjun 已提交
632 633 634
};

/**
M
mamingshuai 已提交
635 636
 * @tc.number    : SUB_UTILS_PARAMETER_4000
 * @tc.name      : GetParameter parameter legal test using key with only lowercase
W
wenjun 已提交
637 638
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
639
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter003, Function | MediumTest | Level1)
W
wenjun 已提交
640 641 642 643 644 645 646 647 648
{
    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 已提交
649
    TEST_ASSERT_EQUAL_STRING(rightVal, value);
W
wenjun 已提交
650 651 652
};

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

/**
M
mamingshuai 已提交
671 672
 * @tc.number    : SUB_UTILS_PARAMETER_4200
 * @tc.name      : GetParameter parameter legal test when defaut value point is nullptr
W
wenjun 已提交
673 674
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
675
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter005, Function | MediumTest | Level1)
W
wenjun 已提交
676 677 678 679
{
    int ret;

    char key[] = "rw.sys.version_606";
M
mamingshuai 已提交
680
    char rightVal[] = "OEM-10.1.0";
W
wenjun 已提交
681 682 683 684
    char value[MAX_LEN] = {0};
    SetParameter(key, rightVal);
    ret = GetParameter(key, NULL, value, MAX_LEN);
    TEST_ASSERT_EQUAL_INT(strlen(rightVal), ret);
M
mamingshuai 已提交
685
    TEST_ASSERT_EQUAL_STRING(rightVal, value);
W
wenjun 已提交
686 687 688
};

/**
M
mamingshuai 已提交
689 690
 * @tc.number    : SUB_UTILS_PARAMETER_4300
 * @tc.name      : GetParameter parameter legal test when the key is not exist
W
wenjun 已提交
691 692
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
693
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter006, Function | MediumTest | Level1)
W
wenjun 已提交
694 695 696 697 698 699 700
{
    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 已提交
701
    TEST_ASSERT_EQUAL_STRING(g_defSysParam, value);
W
wenjun 已提交
702 703 704
};

/**
M
mamingshuai 已提交
705 706
 * @tc.number    : SUB_UTILS_PARAMETER_4400
 * @tc.name      : GetParameter parameter legal test using key and value with maximum length
W
wenjun 已提交
707 708
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
709
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter007, Function | MediumTest | Level1)
W
wenjun 已提交
710 711 712 713 714 715 716 717 718
{
    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 已提交
719
    TEST_ASSERT_EQUAL_STRING(rightVal1, value1);
W
wenjun 已提交
720 721 722 723 724 725 726 727

    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 已提交
728
    TEST_ASSERT_EQUAL_STRING(rightVal2, value2);
W
wenjun 已提交
729 730 731
};

/**
M
mamingshuai 已提交
732 733
 * @tc.number    : SUB_UTILS_PARAMETER_4500
 * @tc.name      : GetParameter parameter illegal test with invalid value length
W
wenjun 已提交
734 735
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
736
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter008, Function | MediumTest | Level1)
W
wenjun 已提交
737 738 739 740
{
    int ret;

    char key[] = "rw.sys.version_606";
M
mamingshuai 已提交
741
    char rightVal[] = "OEM-10.1.0";
W
wenjun 已提交
742 743 744 745 746 747 748 749 750 751
    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 已提交
752 753
 * @tc.number    : SUB_UTILS_PARAMETER_4600
 * @tc.name      : GetParameter parameter illegal test when value point is nullptr
W
wenjun 已提交
754 755
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
756
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter009, Function | MediumTest | Level1)
W
wenjun 已提交
757 758 759 760
{
    int ret;

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

/**
M
mamingshuai 已提交
943
 * @tc.number    : SUB_UTILS_PARAMETER_5700
W
wenjun 已提交
944 945 946
 * @tc.name      : Update value of parameter legal test
 * @tc.desc      : [C- SOFTWARE -0200]
 */
M
mamingshuai 已提交
947
LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter020, Function | MediumTest | Level1)
W
wenjun 已提交
948 949 950 951
{
    int ret;

    char key[] = "rw.sys.version_606";
M
mamingshuai 已提交
952
    char rightVal1[] = "OEM-10.1.0";
W
wenjun 已提交
953 954 955 956 957
    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 已提交
958
    TEST_ASSERT_EQUAL_STRING(rightVal1, value1);
W
wenjun 已提交
959

M
mamingshuai 已提交
960
    char rightVal2[] = "update the value of OEM-10.1.0";
W
wenjun 已提交
961 962 963 964 965
    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 已提交
966
    TEST_ASSERT_EQUAL_STRING(rightVal2, value2);
W
wenjun 已提交
967 968 969
};

RUN_TEST_SUITE(ParameterFuncTestSuite);