1 /*
2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <gtest/gtest.h>
17 #include <memory>
18 #include <regex>
19
20 #define private public
21 #define protected public
22 #include "pac_map.h"
23 #undef protected
24 #undef private
25 #include "user_object_base.h"
26
27 namespace OHOS {
28 namespace AppExecFwk {
29 using namespace testing::ext;
30 using namespace OHOS;
31 using namespace OHOS::AppExecFwk;
32
33 #define PAC_MPA_TEST_INT 1000
34 #define PAC_MAP_TEST_LONG (-1000)
35 #define PAC_MAP_TEST_FLOAT 1.0f
36 #define PAC_MAP_TEST_DOUBLE 3.1415926
37 namespace {
38 const std::regex INTEGER_REGEX("^[-+]?([0-9]+)([.]([0-9]+))?$");
39 };
40 class TUserObjectTest : public UserObjectBase {
41 public:
TUserObjectTest()42 TUserObjectTest() : UserObjectBase("TUserObjectTest"), strData_("用户自定义对象"), intData_(0)
43 {}
~TUserObjectTest()44 ~TUserObjectTest()
45 {}
46
ToString() const47 std::string ToString() const override
48 {
49 std::string tostring = strData_;
50 tostring += "#" + std::to_string(intData_);
51 return tostring;
52 }
53
Parse(const std::string & str)54 void Parse(const std::string& str) override
55 {
56 std::vector<std::string> elems;
57
58 std::size_t splitPos = str.find("#");
59 if (splitPos == std::string::npos) {
60 return;
61 }
62 std::string strData = str.substr(0, splitPos);
63 std::string intdata = str.substr(strData.length() + 1, str.length() - 1);
64 if (strData.length() + 1 + intdata.length() != str.length()) {
65 return;
66 }
67 bool isNumber = std::regex_match(intdata, INTEGER_REGEX);
68 if (isNumber) {
69 strData_ = strData;
70 intData_ = std::stoi(intdata);
71 }
72 }
73
Equals(std::shared_ptr<UserObjectBase> & other)74 bool Equals(std::shared_ptr<UserObjectBase>& other) override
75 {
76 if (other->GetClassName() != GetClassName()) {
77 return false;
78 }
79
80 TUserObjectTest* pobject = static_cast<TUserObjectTest*>(other.get());
81 if (pobject == nullptr) {
82 return false;
83 }
84 return ((strData_ == pobject->strData_) && (intData_ == pobject->intData_));
85 }
86
DeepCopy(std::shared_ptr<UserObjectBase> & other)87 void DeepCopy(std::shared_ptr<UserObjectBase>& other) override
88 {
89 if (other->GetClassName() != GetClassName()) {
90 return;
91 }
92
93 TUserObjectTest* pobject = static_cast<TUserObjectTest*>(other.get());
94 if (pobject != nullptr) {
95 strData_ = pobject->strData_;
96 intData_ = pobject->intData_;
97 }
98 }
99
Marshalling(Parcel & parcel) const100 bool Marshalling(Parcel& parcel) const override
101 {
102 return true;
103 }
104
Unmarshalling(Parcel & parcel)105 bool Unmarshalling(Parcel& parcel) override
106 {
107 return true;
108 }
109
110 private:
111 std::string strData_ = "";
112 int intData_ = 0;
113 };
114 REGISTER_USER_OBJECT_BASE(TUserObjectTest);
115
116 /*
117 * Description:Test for data type of base: like int, short, long std::string etc.
118 */
119 class PacMapTest : public testing::Test {
120 public:
PacMapTest()121 PacMapTest() : pacmap_(nullptr)
122 {}
~PacMapTest()123 ~PacMapTest()
124 {}
125
126 std::shared_ptr<PacMap> pacmap_ = nullptr;
127 std::shared_ptr<PacMap> pacmap2_ = nullptr;
128 static void FillData(PacMap& pacmap);
129 static void FillData2(PacMap& pacmap, const PacMap& param_map);
130
131 static void SetUpTestCase(void);
132 static void TearDownTestCase(void);
133 void SetUp();
134 void TearDown();
135 };
136
SetUpTestCase(void)137 void PacMapTest::SetUpTestCase(void)
138 {}
139
TearDownTestCase(void)140 void PacMapTest::TearDownTestCase(void)
141 {}
142
SetUp()143 void PacMapTest::SetUp()
144 {
145 pacmap_ = std::make_shared<PacMap>();
146 pacmap2_ = std::make_shared<PacMap>();
147 }
148
TearDown()149 void PacMapTest::TearDown()
150 {}
151
FillData(PacMap & pacmap)152 void PacMapTest::FillData(PacMap& pacmap)
153 {
154 std::vector<short> arrayShort;
155 std::vector<int> arrayInt;
156 std::vector<long> arrayLong;
157 std::vector<AAFwk::byte> arrayByte;
158 std::vector<bool> arrayBool;
159 std::vector<float> arrayFloat;
160 std::vector<double> arrayDouble;
161 std::vector<std::string> arrayString;
162
163 arrayShort.push_back(PAC_MPA_TEST_INT);
164 arrayInt.push_back(PAC_MPA_TEST_INT);
165 arrayLong.push_back(PAC_MAP_TEST_LONG);
166 arrayByte.push_back('a');
167 arrayBool.push_back(true);
168 arrayFloat.push_back(PAC_MAP_TEST_FLOAT);
169 arrayDouble.push_back(PAC_MAP_TEST_DOUBLE);
170 arrayString.push_back("<~!@#$%^&*()_+>特殊字符");
171
172 pacmap.PutShortValue("key_short", PAC_MPA_TEST_INT);
173 pacmap.PutIntValue("key_int", PAC_MPA_TEST_INT);
174 pacmap.PutLongValue("key_long", PAC_MAP_TEST_LONG);
175 pacmap.PutByteValue("key_byte", 'A');
176 pacmap.PutBooleanValue("key_boolean", true);
177 pacmap.PutFloatValue("key_float", PAC_MAP_TEST_FLOAT);
178 pacmap.PutDoubleValue("key_double", PAC_MAP_TEST_DOUBLE);
179 pacmap.PutStringValue("key_string", "test clone");
180
181 std::shared_ptr<TUserObjectTest> pubObject = std::make_shared<TUserObjectTest>();
182 pacmap.PutObject("key_object", pubObject);
183
184 pacmap.PutShortValueArray("key_short_array", arrayShort);
185 pacmap.PutIntValueArray("key_int_array", arrayInt);
186 pacmap.PutLongValueArray("key_long_array", arrayLong);
187 pacmap.PutByteValueArray("key_byte_array", arrayByte);
188 pacmap.PutFloatValueArray("key_float_array", arrayFloat);
189 pacmap.PutBooleanValueArray("key_boolean_array", arrayBool);
190 pacmap.PutDoubleValueArray("key_double_array", arrayDouble);
191 pacmap.PutStringValueArray("key_string_array", arrayString);
192 }
193
FillData2(PacMap & pacmap,const PacMap & param_map)194 void PacMapTest::FillData2(PacMap& pacmap, const PacMap& param_map)
195 {
196 std::vector<short> arrayShort;
197 std::vector<int> arrayInt;
198 std::vector<long> arrayLong;
199 std::vector<AAFwk::byte> arrayByte;
200 std::vector<bool> arrayBool;
201 std::vector<float> arrayFloat;
202 std::vector<double> arrayDouble;
203 std::vector<std::string> arrayString;
204
205 arrayShort.push_back(PAC_MPA_TEST_INT);
206 arrayInt.push_back(PAC_MPA_TEST_INT);
207 arrayLong.push_back(PAC_MAP_TEST_LONG);
208 arrayByte.push_back('a');
209 arrayBool.push_back(true);
210 arrayFloat.push_back(PAC_MAP_TEST_FLOAT);
211 arrayDouble.push_back(PAC_MAP_TEST_DOUBLE);
212 arrayString.push_back("<~!@#$%^&*()_+>特殊字符");
213
214 pacmap.PutShortValue("key_short", PAC_MPA_TEST_INT);
215 pacmap.PutIntValue("key_int", PAC_MPA_TEST_INT);
216 pacmap.PutLongValue("key_long", PAC_MAP_TEST_LONG);
217 pacmap.PutByteValue("key_byte", 'A');
218 pacmap.PutBooleanValue("key_boolean", true);
219 pacmap.PutFloatValue("key_float", PAC_MAP_TEST_FLOAT);
220 pacmap.PutDoubleValue("key_double", PAC_MAP_TEST_DOUBLE);
221 pacmap.PutStringValue("key_string", "test clone");
222
223 pacmap.PutPacMap("key_map", param_map);
224
225 pacmap.PutShortValueArray("key_short_array", arrayShort);
226 pacmap.PutIntValueArray("key_int_array", arrayInt);
227 pacmap.PutLongValueArray("key_long_array", arrayLong);
228 pacmap.PutByteValueArray("key_byte_array", arrayByte);
229 pacmap.PutFloatValueArray("key_float_array", arrayFloat);
230 pacmap.PutBooleanValueArray("key_boolean_array", arrayBool);
231 pacmap.PutDoubleValueArray("key_double_array", arrayDouble);
232 pacmap.PutStringValueArray("key_string_array", arrayString);
233 }
234 /**
235 * @tc.number: AppExecFwk_PacMap_PutShortValue_0100
236 * @tc.name: PutShortValue
237 * @tc.desc: Verify PutShortValue() and GetShortValue().
238 */
239 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutShortValue_0100, Function | MediumTest | Level1)
240 {
241 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutShortValue_0100 start";
242 short value = 1000;
243 pacmap_->PutShortValue("key_short", value);
244 EXPECT_EQ(value, pacmap_->GetShortValue("key_short"));
245 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutShortValue_0100 end";
246 }
247
248 /**
249 * @tc.number: AppExecFwk_PacMap_PutIntValue_0100
250 * @tc.name: PutIntValue and GetIntValue
251 * @tc.desc: Verify PutIntValue() and GetIntValue().
252 */
253 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutIntValue_0100, Function | MediumTest | Level1)
254 {
255 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutIntValue_0100 start";
256 int value = 1000;
257 pacmap_->PutIntValue("key_int", value);
258 EXPECT_EQ(value, pacmap_->GetIntValue("key_int"));
259 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutIntValue_0100 end";
260 }
261
262 /**
263 * @tc.number: AppExecFwk_PacMap_PutLongValue_0100
264 * @tc.name: PutLongValue and GetLongValue
265 * @tc.desc: Verify PutLongValue() and GetLongValue().
266 */
267 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutLongValue_0100, Function | MediumTest | Level1)
268 {
269 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutLongValue_0100 start";
270 long value = -1000;
271 pacmap_->PutLongValue("key_long", value);
272 EXPECT_EQ(value, pacmap_->GetLongValue("key_long"));
273 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutLongValue_0100 end";
274 }
275
276 /**
277 * @tc.number: AppExecFwk_PacMap_PutByteValue_0100
278 * @tc.name: PutByteValue and GetByteValue
279 * @tc.desc: Verify PutByteValue() and GetByteValue().
280 */
281 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutByteValue_0100, Function | MediumTest | Level1)
282 {
283 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutByteValue_0100 start";
284 AAFwk::byte value = 'A';
285 pacmap_->PutByteValue("key_byte", value);
286 EXPECT_EQ(value, pacmap_->GetByteValue("key_byte"));
287 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutByteValue_0100 end";
288 }
289
290 /**
291 * @tc.number: AppExecFwk_PacMap_PutBooleanValue_0100
292 * @tc.name: PutBooleanValue and GetBooleanValue
293 * @tc.desc: Verify PutBooleanValue() and GetBooleanValue().
294 */
295 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutBooleanValue_0100, Function | MediumTest | Level1)
296 {
297 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutBooleanValue_0100 start";
298 bool value = true;
299 pacmap_->PutBooleanValue("key_boolean_true", value);
300 EXPECT_EQ(value, pacmap_->GetBooleanValue("key_boolean_true"));
301
302 value = false;
303 pacmap_->PutBooleanValue("key_boolean_false", value);
304 EXPECT_EQ(value, pacmap_->GetBooleanValue("key_boolean_false"));
305
306 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutBooleanValue_0100 end";
307 }
308
309 /**
310 * @tc.number: AppExecFwk_PacMap_PutFloatValue_0100
311 * @tc.name: PutFloatValue and GetFloatValue
312 * @tc.desc: Verify PutFloatValue() and GetFloatValue().
313 */
314 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutFloatValue_0100, Function | MediumTest | Level1)
315 {
316 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutFloatValue_0100 start";
317 float value = 3.14f;
318 pacmap_->PutFloatValue("key_float", value);
319 EXPECT_EQ(value, pacmap_->GetFloatValue("key_float"));
320 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutFloatValue_0100 end";
321 }
322
323 /**
324 * @tc.number: AppExecFwk_PacMap_PutDoubleValue_0100
325 * @tc.name: PutDoubleValue and GetDoubleValue
326 * @tc.desc: Verify PutDoubleValue() and GetDoubleValue().
327 */
328 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutDoubleValue_0100, Function | MediumTest | Level1)
329 {
330 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutDoubleValue_0100 start";
331 double value = 3.1415926;
332 pacmap_->PutDoubleValue("key_double", value);
333 EXPECT_EQ(value, pacmap_->GetDoubleValue("key_double"));
334 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutDoubleValue_0100 end";
335 }
336
337 /**
338 * @tc.number: AppExecFwk_PacMap_PutStringValue_0100
339 * @tc.name: PutStringValue and GetStringValue
340 * @tc.desc: Verify PutStringValue() and GetStringValue().
341 */
342 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutStringValue_0100, Function | MediumTest | Level1)
343 {
344 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutStringValue_0100 start";
345 std::string value("AppExecFwk_PacMap_PutStringValue_0100 PACMAP测试");
346 pacmap_->PutStringValue("key_string", value);
347 std::string getStr = pacmap_->GetStringValue("key_string");
348 EXPECT_STREQ(value.c_str(), getStr.c_str());
349 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutStringValue_0100 end";
350 }
351
352 /**
353 * @tc.number: AppExecFwk_PacMap_PutShortValueArray_0100
354 * @tc.name: PutShortValueArray and GetShortValueArray
355 * @tc.desc: Verify PutShortValueArray() and GetShortValueArray().
356 */
357 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutShortValueArray_0100, Function | MediumTest | Level1)
358 {
359 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutShortValueArray_0100 start";
360
361 std::vector<short> putValue;
362 std::vector<short> getValue;
363 for (int i = 0; i < 100; i++) {
364 putValue.emplace_back(i + 1);
365 }
366 pacmap_->PutShortValueArray("key_short_array", putValue);
367 pacmap_->GetShortValueArray("key_short_array", getValue);
368
369 bool isEqual = (putValue == getValue);
370 EXPECT_EQ(true, isEqual);
371
372 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutShortValueArray_0100 end";
373 }
374
375 /**
376 * @tc.number: AppExecFwk_PacMap_PutIntValueArray_0100
377 * @tc.name: PutIntValueArray and GetIntValueArray
378 * @tc.desc: Verify PutIntValueArray() and GetIntValueArray().
379 */
380 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutIntValueArray_0100, Function | MediumTest | Level1)
381 {
382 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutIntValueArray_0100 start";
383
384 std::vector<int> putValue;
385 std::vector<int> getValue;
386 for (int i = 0; i < 100; i++) {
387 putValue.emplace_back(i + 1);
388 }
389 pacmap_->PutIntValueArray("key_int_array", putValue);
390 pacmap_->GetIntValueArray("key_int_array", getValue);
391
392 bool isEqual = (putValue == getValue);
393 EXPECT_EQ(true, isEqual);
394
395 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutIntValueArray_0100 end";
396 }
397
398 /**
399 * @tc.number: AppExecFwk_PacMap_PutLongArray_0100
400 * @tc.name: PutLongValueArray and GetLongValueArray
401 * @tc.desc: Verify PutLongValueArray() and GetLongValueArray().
402 */
403 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutLongArray_0100, Function | MediumTest | Level1)
404 {
405 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutLongArray_0100 start";
406
407 std::vector<long> putValue;
408 std::vector<long> getValue;
409 for (int i = 0; i < 100; i++) {
410 putValue.emplace_back(i + 1);
411 }
412 pacmap_->PutLongValueArray("key_long_array", putValue);
413 pacmap_->GetLongValueArray("key_long_array", getValue);
414
415 bool isEqual = (putValue == getValue);
416 EXPECT_EQ(true, isEqual);
417
418 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutLongArray_0100 end";
419 }
420
421 /**
422 * @tc.number: AppExecFwk_PacMap_PutByteArray_0100
423 * @tc.name: PutByteValueArray and GetByteValueArray
424 * @tc.desc: Verify PutByteValueArray() and GetByteValueArray().
425 */
426 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutByteArray_0100, Function | MediumTest | Level1)
427 {
428 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutByteArray_0100 start";
429
430 std::vector<AAFwk::byte> putValue;
431 std::vector<AAFwk::byte> getValue;
432 for (int i = 0; i < 26; i++) {
433 putValue.emplace_back('A' + i);
434 }
435 pacmap_->PutByteValueArray("key_byte_array", putValue);
436 pacmap_->GetByteValueArray("key_byte_array", getValue);
437
438 bool isEqual = (putValue == getValue);
439 EXPECT_EQ(true, isEqual);
440
441 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutByteArray_0100 end";
442 }
443
444 /**
445 * @tc.number: AppExecFwk_PacMap_PutFloatArray_0100
446 * @tc.name: PutLongValueArray and GetLongValueArray
447 * @tc.desc: Verify PutLongValueArray() and GetLongValueArray().
448 */
449 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutFloatArray_0100, Function | MediumTest | Level1)
450 {
451 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutFloatArray_0100 start";
452
453 std::vector<float> putValue;
454 std::vector<float> getValue;
455 for (int i = 0; i < 100; i++) {
456 putValue.emplace_back((i + 1) * 1.0f);
457 }
458 pacmap_->PutFloatValueArray("key_long_array", putValue);
459 pacmap_->GetFloatValueArray("key_long_array", getValue);
460
461 bool isEqual = (putValue == getValue);
462 EXPECT_EQ(true, isEqual);
463
464 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutFloatArray_0100 end";
465 }
466
467 /**
468 * @tc.number: AppExecFwk_PacMap_PutDoubleArray_0100
469 * @tc.name: PutDoubleValueArray and GetDoubleValueArray
470 * @tc.desc: Verify PutDoubleValueArray() and GetDoubleValueArray().
471 */
472 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutDoubleArray_0100, Function | MediumTest | Level1)
473 {
474 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutDoubleArray_0100 start";
475
476 std::vector<double> putValue;
477 std::vector<double> getValue;
478 for (int i = 0; i < 100; i++) {
479 putValue.emplace_back((i + 1) * 1.0);
480 }
481 pacmap_->PutDoubleValueArray("key_double_array", putValue);
482 pacmap_->GetDoubleValueArray("key_double_array", getValue);
483
484 bool isEqual = (putValue == getValue);
485 EXPECT_EQ(true, isEqual);
486
487 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutDoubleArray_0100 end";
488 }
489
490 /**
491 * @tc.number: AppExecFwk_PacMap_PutStringArray_0100
492 * @tc.name: PutStringValueArray and GetStringValueArray
493 * @tc.desc: Verify PutStringValueArray() and GetStringValueArray().
494 */
495 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutStringArray_0100, Function | MediumTest | Level1)
496 {
497 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutStringArray_0100 start";
498
499 std::vector<std::string> tempValue;
500 std::vector<std::string> putValue;
501 std::vector<std::string> getValue;
502
503 tempValue.emplace_back("Adds a String value matching a specified key.");
504 tempValue.emplace_back("添加字符串");
505 tempValue.emplace_back("<~!@#$%^&*()_+>特殊字符");
506
507 for (int i = 0; i < 100; i++) {
508 putValue.emplace_back(tempValue[i % 3]);
509 }
510 pacmap_->PutStringValueArray("key_string_array", putValue);
511 pacmap_->GetStringValueArray("key_string_array", getValue);
512
513 bool isEqual = (putValue == getValue);
514 EXPECT_EQ(true, isEqual);
515
516 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutStringArray_0100 end";
517 }
518
519 /**
520 * @tc.number: AppExecFwk_PacMap_PutObject_0100
521 * @tc.name: PutObject and GetObject
522 * @tc.desc: Verify PutObject() and GetObject().
523 */
524 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutObject_0100, Function | MediumTest | Level1)
525 {
526 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutObject_0100 start";
527
528 std::shared_ptr<TUserObjectTest> putObject = std::make_shared<TUserObjectTest>();
529 pacmap_->PutObject("key_object", putObject);
530
531 std::shared_ptr<UserObjectBase> getObject = pacmap_->GetObject("key_object");
532 bool isEqual = false;
533 if (getObject.get() != nullptr) {
534 isEqual = getObject->Equals(getObject);
535 }
536 EXPECT_EQ(true, isEqual);
537
538 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutObject_0100 end";
539 }
540
541 /**
542 * @tc.number: AppExecFwk_PacMap_Clone_0100
543 * @tc.name: Clone and Equals
544 * @tc.desc: Verify Clone() and Equals().
545 */
546 HWTEST_F(PacMapTest, AppExecFwk_PacMap_Clone_0100, Function | MediumTest | Level1)
547 {
548 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Clone_0100 start";
549
550 PacMap otherMap;
551 FillData(*pacmap_.get());
552 otherMap = pacmap_->Clone();
553 EXPECT_EQ(true, pacmap_->Equals(otherMap));
554
555 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Clone_0100 end";
556 }
557
558 /**
559 * @tc.number: AppExecFwk_PacMap_DeepCopy_0100
560 * @tc.name: DeepCopy
561 * @tc.desc: Verify DeepCopy().
562 */
563 HWTEST_F(PacMapTest, AppExecFwk_PacMap_DeepCopy_0100, Function | MediumTest | Level1)
564 {
565 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_DeepCopy_0100 start";
566
567 PacMap otherMap;
568 FillData(*pacmap_.get());
569 otherMap = pacmap_->DeepCopy();
570 EXPECT_EQ(true, pacmap_->Equals(otherMap));
571
572 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_DeepCopy_0100 end";
573 }
574
575 /**
576 * @tc.number: AppExecFwk_PacMap_Clear_0100
577 * @tc.name: Clear and GetSize
578 * @tc.desc: Verify Clear() and GetSize().
579 */
580 HWTEST_F(PacMapTest, AppExecFwk_PacMap_Clear_0100, Function | MediumTest | Level1)
581 {
582 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Clear_0100 start";
583
584 FillData(*pacmap_.get());
585 pacmap_->Clear();
586 EXPECT_EQ(0, pacmap_->GetSize());
587
588 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Clear_0100 end";
589 }
590
591 /**
592 * @tc.number: AppExecFwk_PacMap_PutAll_0100
593 * @tc.name: PutAll
594 * @tc.desc: Verify PutAll().
595 */
596 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutAll_0100, Function | MediumTest | Level1)
597 {
598 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutAll_0100 start";
599
600 PacMap otherMap;
601 FillData(otherMap);
602 pacmap_->PutAll(otherMap);
603 EXPECT_EQ(true, pacmap_->Equals(otherMap));
604
605 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutAll_0100 end";
606 }
607
608 /**
609 * @tc.number: AppExecFwk_PacMap_GetAll_0100
610 * @tc.name: GetAll
611 * @tc.desc: Verify GetAll().
612 */
613 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetAll_0100, Function | MediumTest | Level1)
614 {
615 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetAll_0100 start";
616
617 FillData(*pacmap_.get());
618 std::map<std::string, PacMapObject::INTERFACE> data = pacmap_->GetAll();
619
620 EXPECT_EQ(data.size(), (std::size_t)pacmap_->GetSize());
621
622 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetAll_0100 end";
623 }
624
625 /**
626 * @tc.number: AppExecFwk_PacMap_HasKey_0100
627 * @tc.name: HasKey
628 * @tc.desc: Verify HasKey().
629 */
630 HWTEST_F(PacMapTest, AppExecFwk_PacMap_HasKey_0100, Function | MediumTest | Level1)
631 {
632 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_HasKey_0100 start";
633
634 FillData(*pacmap_.get());
635 EXPECT_EQ(true, pacmap_->HasKey("key_short_array"));
636
637 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_HasKey_0100 end";
638 }
639
640 /**
641 * @tc.number: AppExecFwk_PacMap_GetKeys_0100
642 * @tc.name: GetKeys
643 * @tc.desc: Verify GetKeys().
644 */
645 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetKeys_0100, Function | MediumTest | Level1)
646 {
647 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetKeys_0100 start";
648
649 FillData(*pacmap_.get());
650 const std::set<std::string> keys = pacmap_->GetKeys();
651 EXPECT_EQ((int)keys.size(), pacmap_->GetSize());
652
653 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetKeys_0100 end";
654 }
655
656 /**
657 * @tc.number: AppExecFwk_PacMap_Remove_0100
658 * @tc.name: Remove
659 * @tc.desc: Verify Remove().
660 */
661 HWTEST_F(PacMapTest, AppExecFwk_PacMap_Remove_0100, Function | MediumTest | Level1)
662 {
663 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Remove_0100 start";
664
665 FillData(*pacmap_.get());
666 EXPECT_EQ(true, pacmap_->HasKey("key_short_array"));
667 pacmap_->Remove("key_short_array");
668 EXPECT_EQ(false, pacmap_->HasKey("key_short_array"));
669
670 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Remove_0100 end";
671 }
672
673 /**
674 * @tc.number: AppExecFwk_PacMap_IsEmpty_0100
675 * @tc.name: IsEmpty
676 * @tc.desc: Verify IsEmpty().
677 */
678 HWTEST_F(PacMapTest, AppExecFwk_PacMap_IsEmpty_0100, Function | MediumTest | Level1)
679 {
680 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_IsEmpty_0100 start";
681
682 FillData(*pacmap_.get());
683 EXPECT_EQ(false, pacmap_->IsEmpty());
684 pacmap_->Clear();
685 EXPECT_EQ(true, pacmap_->IsEmpty());
686
687 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_IsEmpty_0100 end";
688 }
689
690 /**
691 * @tc.number: AppExecFwk_PacMap_Marshalling_0100
692 * @tc.name: Marshalling and Unmarshalling
693 * @tc.desc: Verify Marshalling() and Unmarshalling().
694 */
695 HWTEST_F(PacMapTest, AppExecFwk_PacMap_Marshalling_0100, Function | MediumTest | Level1)
696 {
697 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Marshalling_0100 start";
698
699 Parcel parcel;
700 FillData(*pacmap_.get());
701 EXPECT_EQ(true, pacmap_->Marshalling(parcel));
702
703 PacMap* unmarshingMap = PacMap::Unmarshalling(parcel);
704 EXPECT_EQ(true, unmarshingMap != nullptr);
705 if (unmarshingMap != nullptr) {
706 EXPECT_EQ(true, pacmap_->Equals(unmarshingMap));
707 delete unmarshingMap;
708 unmarshingMap = nullptr;
709 }
710 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Marshalling_0100 end";
711 }
712 /**
713 * @tc.number: AppExecFwk_PacMap_Marshalling_0200
714 * @tc.name: Marshalling and Unmarshalling
715 * @tc.desc: Verify Marshalling() and Unmarshalling().
716 */
717 HWTEST_F(PacMapTest, AppExecFwk_PacMap_Marshalling_0200, Function | MediumTest | Level1)
718 {
719 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Marshalling_0200 start";
720
721 Parcel parcel;
722 FillData(*pacmap_.get());
723 FillData2(*pacmap2_.get(), *pacmap_.get());
724
725 EXPECT_EQ(true, pacmap2_->Marshalling(parcel));
726 PacMap* unmarshingMap = PacMap::Unmarshalling(parcel);
727
728 EXPECT_EQ(true, unmarshingMap != nullptr);
729 if (unmarshingMap != nullptr) {
730 EXPECT_EQ(true, pacmap2_->Equals(unmarshingMap));
731 delete unmarshingMap;
732 unmarshingMap = nullptr;
733 }
734 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Marshalling_0200 end";
735 }
736 /**
737 * @tc.number: AppExecFwk_PacMap_Marshalling_0300
738 * @tc.name: Marshalling and Unmarshalling
739 * @tc.desc: Verify Marshalling() and Unmarshalling().
740 */
741 HWTEST_F(PacMapTest, AppExecFwk_PacMap_Marshalling_0300, Function | MediumTest | Level1)
742 {
743 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Marshalling_0300 start";
744
745 Parcel parcel;
746 EXPECT_EQ(true, pacmap2_->Marshalling(parcel));
747 PacMap* unmarshingMap = PacMap::Unmarshalling(parcel);
748
749 EXPECT_EQ(true, unmarshingMap != nullptr);
750 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Marshalling_0300 end";
751 }
752
753 /**
754 * @tc.number: AppExecFwk_PacMap_PutCharValue_0100
755 * @tc.name: PutCharValue and GetCharValue
756 * @tc.desc: Verify PutCharValue() and GetCharValue().
757 */
758 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutCharValue_0100, Function | MediumTest | Level1)
759 {
760 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutCharValue_0100 start";
761 char value = 'a';
762 pacmap_->PutCharValue("key_char", value);
763 EXPECT_EQ(value, pacmap_->GetCharValue("key_char"));
764 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutCharValue_0100 end";
765 }
766
767 /**
768 * @tc.number: AppExecFwk_PacMap_PutCharValueArray_0100
769 * @tc.name: PutCharValueArray and GetCharValueArray
770 * @tc.desc: Verify PutCharValueArray() and GetCharValueArray().
771 */
772 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutCharValueArray_0100, Function | MediumTest | Level1)
773 {
774 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutCharValueArray_0100 start";
775
776 std::vector<char> putValue;
777 std::vector<char> getValue;
778 for (int i = 0; i < 26; i++) {
779 putValue.emplace_back('a' + i);
780 }
781 pacmap_->PutCharValueArray("key_char_array", putValue);
782 pacmap_->GetCharValueArray("key_char_array", getValue);
783
784 bool isEqual = (putValue == getValue);
785 EXPECT_EQ(true, isEqual);
786
787 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutCharValueArray_0100 end";
788 }
789
790 /**
791 * @tc.number: AppExecFwk_PacMap_FromString_0100
792 * @tc.name: Marshalling and Unmarshalling
793 * @tc.desc: Verify Marshalling() and Unmarshalling().
794 */
795 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_0100, Function | MediumTest | Level1)
796 {
797 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0100 start";
798 std::string str;
799 auto result = pacmap_->FromString(str);
800 EXPECT_TRUE(!result);
801 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0100 end";
802 }
803
804 /**
805 * @tc.number: AppExecFwk_PacMap_FromString_0200
806 * @tc.name: Marshalling and Unmarshalling
807 * @tc.desc: Verify Marshalling() and Unmarshalling().
808 */
809 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_0200, Function | MediumTest | Level1)
810 {
811 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0200 start";
812 std::string str = "abc";
813 auto result = pacmap_->FromString(str);
814 EXPECT_TRUE(!result);
815 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0200 end";
816 }
817
818 /**
819 * @tc.number: AppExecFwk_PacMap_FromString_0300
820 * @tc.name: Marshalling and Unmarshalling
821 * @tc.desc: Verify type.
822 */
823 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_0300, Function | MediumTest | Level1)
824 {
825 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0300 start";
826 std::string str = "{\"pacmap\":{\"key_boolean\":{\"data\":true,\"type\":\"a\"}}}";
827 auto result = pacmap_->FromString(str);
828 EXPECT_TRUE(result);
829 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0300 end";
830 }
831
832 /**
833 * @tc.number: AppExecFwk_PacMap_FromString_0400
834 * @tc.name: Marshalling and Unmarshalling
835 * @tc.desc: Verify type.
836 */
837 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_0400, Function | MediumTest | Level1)
838 {
839 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0400 start";
840 std::string str = "{\"pacmap\":{\"key_boolean\":{\"data\":\"a\",\"type\":7}}}";
841 auto result = pacmap_->FromString(str);
842 EXPECT_TRUE(result);
843 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0400 end";
844 }
845
846 /**
847 * @tc.number: AppExecFwk_PacMap_FromString_0500
848 * @tc.name: Marshalling and Unmarshalling
849 * @tc.desc: Verify type.
850 */
851 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_0500, Function | MediumTest | Level1)
852 {
853 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0500 start";
854 std::string str = "{\"pacmap\":{\"key_boolean_array\":{\"data\":[{\"a\":\"a\"}],\"type\":1536}}}";
855 auto result = pacmap_->FromString(str);
856 EXPECT_TRUE(result);
857 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0500 end";
858 }
859
860 /**
861 * @tc.number: AppExecFwk_PacMap_FromString_0600
862 * @tc.name: Marshalling and Unmarshalling
863 * @tc.desc: Verify type.
864 */
865 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_0600, Function | MediumTest | Level1)
866 {
867 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0600 start";
868 std::string str = "{\"pacmap\":{\"key_byte\":{\"data\":\"a\",\"type\":5}}}";
869 auto result = pacmap_->FromString(str);
870 EXPECT_TRUE(result);
871 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0600 end";
872 }
873
874 /**
875 * @tc.number: AppExecFwk_PacMap_FromString_0700
876 * @tc.name: Marshalling and Unmarshalling
877 * @tc.desc: Verify type.
878 */
879 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_0700, Function | MediumTest | Level1)
880 {
881 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0700 start";
882 std::string str = "{\"pacmap\":{\"key_byte_array\":{\"data\":[{\"a\":\"a\"}],\"type\":1280}}}";
883 auto result = pacmap_->FromString(str);
884 EXPECT_TRUE(result);
885 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0700 end";
886 }
887
888 /**
889 * @tc.number: AppExecFwk_PacMap_FromString_0800
890 * @tc.name: Marshalling and Unmarshalling
891 * @tc.desc: Verify type.
892 */
893 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_0800, Function | MediumTest | Level1)
894 {
895 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0800 start";
896 std::string str = "{\"pacmap\":{\"key_double\":{\"data\":\"a\",\"type\":9}}}";
897 auto result = pacmap_->FromString(str);
898 EXPECT_TRUE(result);
899 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0800 end";
900 }
901
902 /**
903 * @tc.number: AppExecFwk_PacMap_FromString_0900
904 * @tc.name: Marshalling and Unmarshalling
905 * @tc.desc: Verify type.
906 */
907 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_0900, Function | MediumTest | Level1)
908 {
909 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0900 start";
910 std::string str = "{\"pacmap\":{\"key_double_array\":{\"data\":[{\"a\":\"a\"}],\"type\":2048}}}";
911 auto result = pacmap_->FromString(str);
912 EXPECT_TRUE(result);
913 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_0900 end";
914 }
915
916 /**
917 * @tc.number: AppExecFwk_PacMap_FromString_1000
918 * @tc.name: Marshalling and Unmarshalling
919 * @tc.desc: Verify type.
920 */
921 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_1000, Function | MediumTest | Level1)
922 {
923 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1000 start";
924 std::string str = "{\"pacmap\":{\"key_float\":{\"data\":\"a\",\"type\":8}}}";
925 auto result = pacmap_->FromString(str);
926 EXPECT_TRUE(result);
927 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1000 end";
928 }
929
930 /**
931 * @tc.number: AppExecFwk_PacMap_FromString_1100
932 * @tc.name: Marshalling and Unmarshalling
933 * @tc.desc: Verify type.
934 */
935 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_1100, Function | MediumTest | Level1)
936 {
937 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1100 start";
938 std::string str = "{\"pacmap\":{\"key_float_array\":{\"data\":[{\"a\":\"a\"}],\"type\":1792}}}";
939 auto result = pacmap_->FromString(str);
940 EXPECT_TRUE(result);
941 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1100 end";
942 }
943
944 /**
945 * @tc.number: AppExecFwk_PacMap_FromString_1200
946 * @tc.name: Marshalling and Unmarshalling
947 * @tc.desc: Verify type.
948 */
949 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_1200, Function | MediumTest | Level1)
950 {
951 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1200 start";
952 std::string str = "{\"pacmap\":{\"key_int\":{\"data\":\"a\",\"type\":2}}}";
953 auto result = pacmap_->FromString(str);
954 EXPECT_TRUE(result);
955 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1200 end";
956 }
957
958 /**
959 * @tc.number: AppExecFwk_PacMap_FromString_1300
960 * @tc.name: Marshalling and Unmarshalling
961 * @tc.desc: Verify type.
962 */
963 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_1300, Function | MediumTest | Level1)
964 {
965 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1300 start";
966 std::string str = "{\"pacmap\":{\"key_int_array\":{\"data\":[{\"a\":\"a\"}],\"type\":512}}}";
967 auto result = pacmap_->FromString(str);
968 EXPECT_TRUE(result);
969 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1300 end";
970 }
971
972 /**
973 * @tc.number: AppExecFwk_PacMap_FromString_1400
974 * @tc.name: Marshalling and Unmarshalling
975 * @tc.desc: Verify type.
976 */
977 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_1400, Function | MediumTest | Level1)
978 {
979 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1400 start";
980 std::string str = "{\"pacmap\":{\"key_long\":{\"data\":\"a\",\"type\":3}}}";
981 auto result = pacmap_->FromString(str);
982 EXPECT_TRUE(result);
983 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1400 end";
984 }
985
986 /**
987 * @tc.number: AppExecFwk_PacMap_FromString_1500
988 * @tc.name: Marshalling and Unmarshalling
989 * @tc.desc: Verify type.
990 */
991 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_1500, Function | MediumTest | Level1)
992 {
993 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1500 start";
994 std::string str = "{\"pacmap\":{\"key_long_array\":{\"data\":[{\"a\":\"a\"}],\"type\":768}}}";
995 auto result = pacmap_->FromString(str);
996 EXPECT_TRUE(result);
997 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1500 end";
998 }
999
1000 /**
1001 * @tc.number: AppExecFwk_PacMap_FromString_1600
1002 * @tc.name: Marshalling and Unmarshalling
1003 * @tc.desc: Verify type.
1004 */
1005 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_1600, Function | MediumTest | Level1)
1006 {
1007 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1600 start";
1008 std::string str =
1009 "{\"pacmap\":{\"key_object\":{\"class\":\"TUserObjectTest\",\"data\":{\"a\":\"a\"},\"type\":65536}}}";
1010 auto result = pacmap_->FromString(str);
1011 EXPECT_TRUE(result);
1012 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1600 end";
1013 }
1014
1015 /**
1016 * @tc.number: AppExecFwk_PacMap_FromString_1700
1017 * @tc.name: Marshalling and Unmarshalling
1018 * @tc.desc: Verify type.
1019 */
1020 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_1700, Function | MediumTest | Level1)
1021 {
1022 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1700 start";
1023 std::string str = "{\"pacmap\":{\"key_short\":{\"data\":\"a\",\"type\":1}}}";
1024 auto result = pacmap_->FromString(str);
1025 EXPECT_TRUE(result);
1026 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1700 end";
1027 }
1028
1029 /**
1030 * @tc.number: AppExecFwk_PacMap_FromString_1800
1031 * @tc.name: Marshalling and Unmarshalling
1032 * @tc.desc: Verify type.
1033 */
1034 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_1800, Function | MediumTest | Level1)
1035 {
1036 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1800 start";
1037 std::string str = "{\"pacmap\":{\"key_short_array\":{\"data\":[{\"a\":\"a\"}],\"type\":256}}}";
1038 auto result = pacmap_->FromString(str);
1039 EXPECT_TRUE(result);
1040 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1800 end";
1041 }
1042
1043 /**
1044 * @tc.number: AppExecFwk_PacMap_FromString_1900
1045 * @tc.name: Marshalling and Unmarshalling
1046 * @tc.desc: Verify type.
1047 */
1048 HWTEST_F(PacMapTest, AppExecFwk_PacMap_FromString_1900, Function | MediumTest | Level1)
1049 {
1050 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1900 start";
1051 std::string str = "{\"pacmap\":{\"key_string\":{\"data\":{\"a\":\"a\"},\"type\":10}}}";
1052 auto result = pacmap_->FromString(str);
1053 EXPECT_TRUE(result);
1054 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_FromString_1900 end";
1055 }
1056
1057 /**
1058 * @tc.number: AppExecFwk_PacMap_Parse_0100
1059 * @tc.name: Marshalling and Unmarshalling
1060 * @tc.desc: Verify Marshalling() and Unmarshalling().
1061 */
1062 HWTEST_F(PacMapTest, AppExecFwk_PacMap_Parse_0100, Function | MediumTest | Level1)
1063 {
1064 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Parse_0100 start";
1065 std::string str = "abc";
1066 auto result = pacmap_->Parse(str);
1067 EXPECT_TRUE(result != nullptr);
1068 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Parse_0100 end";
1069 }
1070
1071 /**
1072 * @tc.number: AppExecFwk_PacMap_GetCharValueArray_0100
1073 * @tc.name: PutCharValueArray and GetCharValueArray
1074 * @tc.desc: Verify PutCharValueArray() and GetCharValueArray().
1075 */
1076 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetCharValueArray_0100, Function | MediumTest | Level1)
1077 {
1078 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetCharValueArray_0100 start";
1079
1080 std::vector<char> putValue;
1081 std::vector<char> getValue;
1082 for (int i = 0; i < 26; i++) {
1083 putValue.emplace_back('a' + i);
1084 }
1085 pacmap_->PutCharValueArray("key_char_array", putValue);
1086 pacmap_->GetCharValueArray("key_char_array", getValue);
1087
1088 bool isEqual = (putValue == getValue);
1089 EXPECT_EQ(true, isEqual);
1090
1091 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetCharValueArray_0100 end";
1092 }
1093
1094 /**
1095 * @tc.number: AppExecFwk_PacMap_GetBooleanValueArray_0100
1096 * @tc.name: PutBooleanValue and GetBooleanValue
1097 * @tc.desc: Verify PutBooleanValue() and GetBooleanValue().
1098 */
1099 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetBooleanValueArray_0100, Function | MediumTest | Level1)
1100 {
1101 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetBooleanValueArray_0100 start";
1102 std::vector<bool> putValue;
1103 std::vector<bool> getValue;
1104 putValue.emplace_back(true);
1105 pacmap_->PutBooleanValueArray("key_boolean_true", putValue);
1106 pacmap_->GetBooleanValueArray("key_boolean_true", getValue);
1107 bool isEqual = (putValue == getValue);
1108 EXPECT_EQ(true, isEqual);
1109 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetBooleanValueArray_0100 end";
1110 }
1111
1112 /**
1113 * @tc.number: AppExecFwk_PacMap_GetCharValue_0100
1114 * @tc.name: PutCharValue and GetCharValue
1115 * @tc.desc: Verify PutCharValue() and GetCharValue().
1116 */
1117 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetCharValue_0100, Function | MediumTest | Level1)
1118 {
1119 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetCharValue_0100 start";
1120 char value = 'a';
1121 pacmap_->PutCharValue("key_char", value);
1122 EXPECT_EQ(value, pacmap_->GetCharValue("key_char"));
1123 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetCharValue_0100 end";
1124 }
1125
1126 /**
1127 * @tc.number: AppExecFwk_PacMap_DeepCopy_0200
1128 * @tc.name: DeepCopy
1129 * @tc.desc: Verify DeepCopy.
1130 * @tc.require: issueI64N5S
1131 */
1132 HWTEST_F(PacMapTest, AppExecFwk_PacMap_DeepCopy_0200, Function | MediumTest | Level1)
1133 {
1134 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_DeepCopy_0200 start";
1135 PacMap otherMap;
1136 FillData(otherMap);
1137 pacmap_->DeepCopy(otherMap);
1138 EXPECT_EQ(true, pacmap_->Equals(otherMap));
1139 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_DeepCopy_0200 end";
1140 }
1141
1142 /**
1143 * @tc.number: AppExecFwk_PacMap_InnerPutObject_0100
1144 * @tc.name: InnerPutObject
1145 * @tc.desc: Verify InnerPutObject.
1146 * @tc.require: issueI64N5S
1147 */
1148 HWTEST_F(PacMapTest, AppExecFwk_PacMap_InnerPutObject_0100, Function | MediumTest | Level1)
1149 {
1150 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_InnerPutObject_0100 start";
1151
1152 std::shared_ptr<UserObjectBase> value = nullptr;
1153 PacMapList mapList;
1154 std::string key = "this is key";
1155 ASSERT_NE(pacmap_, nullptr);
1156 pacmap_->InnerPutObject(mapList, key, value);
1157
1158 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_InnerPutObject_0100 end";
1159 }
1160
1161 /**
1162 * @tc.number: AppExecFwk_PacMap_PutAll_0200
1163 * @tc.name: PutAll
1164 * @tc.desc: Verify PutAll().
1165 * @tc.require: issueI64N5S
1166 */
1167 HWTEST_F(PacMapTest, AppExecFwk_PacMap_PutAll_0200, Function | MediumTest | Level1)
1168 {
1169 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutAll_0200 start";
1170 FillData(*pacmap_.get());
1171 std::map<std::string, PacMapObject::INTERFACE> data = pacmap_->GetAll();
1172 pacmap_->PutAll(data);
1173 std::string key = "this is key";
1174 int defaultValue = 10;
1175 int result = pacmap_->GetIntValue(key, defaultValue);
1176 EXPECT_EQ(result, defaultValue);
1177
1178 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_PutAll_0200 end";
1179 }
1180
1181 /**
1182 * @tc.number: AppExecFwk_PacMap_GetShortValue_0200
1183 * @tc.name: GetShortValue
1184 * @tc.desc: Verify GetShortValue.
1185 * @tc.require: issueI64N5S
1186 */
1187 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetShortValue_0200, Function | MediumTest | Level1)
1188 {
1189 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetShortValue_0200 start";
1190 FillData(*pacmap_.get());
1191 std::string key = "this is key";
1192 short defaultValue = 10;
1193 short result = pacmap_->GetShortValue(key, defaultValue);
1194 EXPECT_EQ(result, defaultValue);
1195
1196 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetShortValue_0200 end";
1197 }
1198
1199 /**
1200 * @tc.number: AppExecFwk_PacMap_GetBooleanValue_0200
1201 * @tc.name: GetBooleanValue
1202 * @tc.desc: Verify GetBooleanValue.
1203 * @tc.require: issueI64N5S
1204 */
1205 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetBooleanValue_0200, Function | MediumTest | Level1)
1206 {
1207 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetBooleanValue_0200 start";
1208 FillData(*pacmap_.get());
1209 std::string key = "this is key";
1210 bool defaultValue = true;
1211 bool result = pacmap_->GetBooleanValue(key, defaultValue);
1212 EXPECT_EQ(result, defaultValue);
1213
1214 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetBooleanValue_0200 end";
1215 }
1216
1217 /**
1218 * @tc.number: AppExecFwk_PacMap_GetLongValue_0200
1219 * @tc.name: GetLongValue
1220 * @tc.desc: Verify GetLongValue.
1221 * @tc.require: issueI64N5S
1222 */
1223 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetLongValue_0200, Function | MediumTest | Level1)
1224 {
1225 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetLongValue_0200 start";
1226 FillData(*pacmap_.get());
1227 std::string key = "this is key";
1228 long defaultValue = 100;
1229 long result = pacmap_->GetLongValue(key, defaultValue);
1230 EXPECT_EQ(result, defaultValue);
1231
1232 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetLongValue_0200 end";
1233 }
1234
1235 /**
1236 * @tc.number: AppExecFwk_PacMap_GetCharValue_0200
1237 * @tc.name: GetCharValue
1238 * @tc.desc: Verify GetCharValue.
1239 * @tc.require: issueI64N5S
1240 */
1241 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetCharValue_0200, Function | MediumTest | Level1)
1242 {
1243 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetCharValue_0200 start";
1244 FillData(*pacmap_.get());
1245 std::string key = "this is key";
1246 char defaultValue = 'a';
1247 char result = pacmap_->GetCharValue(key, defaultValue);
1248 EXPECT_EQ(result, defaultValue);
1249
1250 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetCharValue_0200 end";
1251 }
1252
1253 /**
1254 * @tc.number: AppExecFwk_PacMap_GetByteValue_0200
1255 * @tc.name: GetByteValue
1256 * @tc.desc: Verify GetByteValue.
1257 * @tc.require: issueI64N5S
1258 */
1259 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetByteValue_0200, Function | MediumTest | Level1)
1260 {
1261 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetByteValue_0200 start";
1262 FillData(*pacmap_.get());
1263 std::string key = "this is key";
1264 AAFwk::byte defaultValue = 'A';
1265 AAFwk::byte result = pacmap_->GetByteValue(key, defaultValue);
1266 EXPECT_EQ(result, defaultValue);
1267
1268 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetByteValue_0200 end";
1269 }
1270
1271 /**
1272 * @tc.number: AppExecFwk_PacMap_GetFloatValue_0200
1273 * @tc.name: GetFloatValue
1274 * @tc.desc: Verify GetFloatValue.
1275 * @tc.require: issueI64N5S
1276 */
1277 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetFloatValue_0200, Function | MediumTest | Level1)
1278 {
1279 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetFloatValue_0200 start";
1280 FillData(*pacmap_.get());
1281 std::string key = "this is key";
1282 float defaultValue = 3.1;
1283 float result = pacmap_->GetFloatValue(key, defaultValue);
1284 EXPECT_EQ(result, defaultValue);
1285
1286 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetFloatValue_0200 end";
1287 }
1288
1289 /**
1290 * @tc.number: AppExecFwk_PacMap_GetDoubleValue_0200
1291 * @tc.name: GetDoubleValue
1292 * @tc.desc: Verify GetDoubleValue.
1293 * @tc.require: issueI64N5S
1294 */
1295 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetDoubleValue_0200, Function | MediumTest | Level1)
1296 {
1297 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetDoubleValue_0200 start";
1298 FillData(*pacmap_.get());
1299 std::string key = "this is key";
1300 double defaultValue = 3.11111;
1301 double result = pacmap_->GetDoubleValue(key, defaultValue);
1302 EXPECT_EQ(result, defaultValue);
1303
1304 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetDoubleValue_0200 end";
1305 }
1306
1307 /**
1308 * @tc.number: AppExecFwk_PacMap_GetStringValue_0200
1309 * @tc.name: GetStringValue
1310 * @tc.desc: Verify GetDoubleValue.
1311 * @tc.require: issueI64N5S
1312 */
1313 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetStringValue_0200, Function | MediumTest | Level1)
1314 {
1315 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetStringValue_0200 start";
1316 FillData(*pacmap_.get());
1317 std::string key = "this is key";
1318 std::string defaultValue = "this is defaultValue";
1319 std::string result = pacmap_->GetStringValue(key, defaultValue);
1320 EXPECT_EQ(result, defaultValue);
1321
1322 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetStringValue_0200 end";
1323 }
1324
1325 /**
1326 * @tc.number: AppExecFwk_PacMap_GetObject_0100
1327 * @tc.name: GetObject
1328 * @tc.desc: Verify GetObject().
1329 * @tc.require: issueI64N5S
1330 */
1331 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetObject_0100, Function | MediumTest | Level1)
1332 {
1333 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetObject_0100 start";
1334
1335 std::string key = "";
1336 std::shared_ptr<UserObjectBase> getObject = pacmap_->GetObject(key);
1337 EXPECT_EQ(getObject, nullptr);
1338
1339 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetObject_0100 end";
1340 }
1341
1342 /**
1343 * @tc.number: AppExecFwk_PacMap_GetPacMap_0100
1344 * @tc.name: GetPacMap
1345 * @tc.desc: Verify GetPacMap.
1346 * @tc.require: issueI64N5S
1347 */
1348 HWTEST_F(PacMapTest, AppExecFwk_PacMap_GetPacMap_0100, Function | MediumTest | Level1)
1349 {
1350 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetPacMap_0100 start";
1351
1352 std::string key = "this is key";
1353 ASSERT_NE(pacmap_, nullptr);
1354 pacmap_->GetPacMap(key);
1355 std::string key1 = "";
1356 pacmap_->GetPacMap(key1);
1357 PacMapList desPacMap;
1358 PacMapList srcPacMap;
1359 pacmap_->ShallowCopyData(desPacMap, srcPacMap);
1360 PacMapList pacMapList;
1361 pacmap_->RemoveData(pacMapList, key1);
1362
1363 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_GetPacMap_0100 end";
1364 }
1365
1366 /**
1367 * @tc.number: AppExecFwk_PacMap_EqualPacMapData_0100
1368 * @tc.name: EqualPacMapData
1369 * @tc.desc: Verify EqualPacMapData.
1370 * @tc.require: issueI64N5S
1371 */
1372 HWTEST_F(PacMapTest, AppExecFwk_PacMap_EqualPacMapData_0100, Function | MediumTest | Level1)
1373 {
1374 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_EqualPacMapData_0100 start";
1375
1376 FillData(*pacmap_.get());
1377 std::map<std::string, PacMapObject::INTERFACE> data = pacmap_->GetAll();
1378 PacMapList rightPacMapList;
1379 bool result = pacmap_->EqualPacMapData(data, rightPacMapList);
1380 EXPECT_EQ(result, false);
1381
1382 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_EqualPacMapData_0100 end";
1383 }
1384
1385 /**
1386 * @tc.number: AppExecFwk_PacMap_CompareArrayData_0100
1387 * @tc.name: CompareArrayData
1388 * @tc.desc: Verify CompareArrayData.
1389 * @tc.require: issueI64N5S
1390 */
1391 HWTEST_F(PacMapTest, AppExecFwk_PacMap_CompareArrayData_0100, Function | MediumTest | Level1)
1392 {
1393 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_CompareArrayData_0100 start";
1394
1395 FillData(*pacmap_.get());
1396 AAFwk::IInterface *one_interface = nullptr;
1397 AAFwk::IInterface *two_interface = nullptr;
1398 bool result = pacmap_->CompareArrayData(one_interface, two_interface);
1399 EXPECT_EQ(result, true);
1400
1401 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_CompareArrayData_0100 end";
1402 }
1403
1404 /**
1405 * @tc.number: AppExecFwk_PacMap_Equals_0200
1406 * @tc.name: Equals
1407 * @tc.desc: Verify Equals.
1408 * @tc.require: issueI64N5S
1409 */
1410 HWTEST_F(PacMapTest, AppExecFwk_PacMap_Equals_0200, Function | MediumTest | Level1)
1411 {
1412 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Equals_0200 start";
1413
1414 bool result = pacmap_->Equals(nullptr);
1415 EXPECT_EQ(result, false);
1416
1417 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_Equals_0200 end";
1418 }
1419
1420 /**
1421 * @tc.number: AppExecFwk_PacMap_ToString_0100
1422 * @tc.name: ToString
1423 * @tc.desc: Verify ToString.
1424 * @tc.require: issueI64N5S
1425 */
1426 HWTEST_F(PacMapTest, AppExecFwk_PacMap_ToString_0100, Function | MediumTest | Level1)
1427 {
1428 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToString_0100 start";
1429
1430 std::string result = pacmap_->ToString();
1431 std::string ret = "{\"pacmap\":null}";
1432 EXPECT_EQ(result, ret);
1433
1434 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToString_0100 end";
1435 }
1436
1437 /**
1438 * @tc.number: AppExecFwk_PacMap_ToJsonArrayShort_0100
1439 * @tc.name: ToJsonArrayShort
1440 * @tc.desc: Verify ToJsonArrayShort.
1441 * @tc.require: issueI64N5S
1442 */
1443 HWTEST_F(PacMapTest, AppExecFwk_PacMap_ToJsonArrayShort_0100, Function | MediumTest | Level1)
1444 {
1445 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayShort_0100 start";
1446
1447 std::vector<short> array;
1448 Json::Value item;
1449 int type = 1;
1450 bool result = pacmap_->ToJsonArrayShort(array, item, type);
1451 EXPECT_EQ(result, false);
1452
1453 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayShort_0100 end";
1454 }
1455
1456 /**
1457 * @tc.number: AppExecFwk_PacMap_ToJsonArrayInt_0100
1458 * @tc.name: ToJsonArrayInt
1459 * @tc.desc: Verify ToJsonArrayInt.
1460 * @tc.require: issueI64N5S
1461 */
1462 HWTEST_F(PacMapTest, AppExecFwk_PacMap_ToJsonArrayInt_0100, Function | MediumTest | Level1)
1463 {
1464 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayInt_0100 start";
1465
1466 std::vector<int> array;
1467 Json::Value item;
1468 int type = 1;
1469 bool result = pacmap_->ToJsonArrayInt(array, item, type);
1470 EXPECT_EQ(result, false);
1471
1472 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayInt_0100 end";
1473 }
1474
1475 /**
1476 * @tc.number: AppExecFwk_PacMap_ToJsonArrayLong_0100
1477 * @tc.name: ToJsonArrayLong
1478 * @tc.desc: Verify ToJsonArrayLong.
1479 * @tc.require: issueI64N5S
1480 */
1481 HWTEST_F(PacMapTest, AppExecFwk_PacMap_ToJsonArrayLong_0100, Function | MediumTest | Level1)
1482 {
1483 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayLong_0100 start";
1484
1485 std::vector<long> array;
1486 Json::Value item;
1487 int type = 1;
1488 bool result = pacmap_->ToJsonArrayLong(array, item, type);
1489 EXPECT_EQ(result, false);
1490
1491 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayLong_0100 end";
1492 }
1493
1494 /**
1495 * @tc.number: AppExecFwk_PacMap_ToJsonArrayByte_0100
1496 * @tc.name: ToJsonArrayByte
1497 * @tc.desc: Verify ToJsonArrayByte.
1498 * @tc.require: issueI64N5S
1499 */
1500 HWTEST_F(PacMapTest, AppExecFwk_PacMap_ToJsonArrayByte_0100, Function | MediumTest | Level1)
1501 {
1502 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayByte_0100 start";
1503
1504 std::vector<byte> array;
1505 Json::Value item;
1506 int type = 1;
1507 bool result = pacmap_->ToJsonArrayByte(array, item, type);
1508 EXPECT_EQ(result, false);
1509
1510 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayByte_0100 end";
1511 }
1512
1513 /**
1514 * @tc.number: AppExecFwk_PacMap_ToJsonArrayBoolean_0100
1515 * @tc.name: ToJsonArrayBoolean
1516 * @tc.desc: Verify ToJsonArrayBoolean.
1517 * @tc.require: issueI64N5S
1518 */
1519 HWTEST_F(PacMapTest, AppExecFwk_PacMap_ToJsonArrayBoolean_0100, Function | MediumTest | Level1)
1520 {
1521 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayBoolean_0100 start";
1522
1523 std::vector<bool> array;
1524 Json::Value item;
1525 int type = 1;
1526 bool result = pacmap_->ToJsonArrayBoolean(array, item, type);
1527 EXPECT_EQ(result, false);
1528
1529 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayBoolean_0100 end";
1530 }
1531
1532 /**
1533 * @tc.number: AppExecFwk_PacMap_ToJsonArrayFloat_0100
1534 * @tc.name: ToJsonArrayFloat
1535 * @tc.desc: Verify ToJsonArrayBoolean.
1536 * @tc.require: issueI64N5S
1537 */
1538 HWTEST_F(PacMapTest, AppExecFwk_PacMap_ToJsonArrayFloat_0100, Function | MediumTest | Level1)
1539 {
1540 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayFloat_0100 start";
1541
1542 std::vector<float> array;
1543 Json::Value item;
1544 int type = 1;
1545 bool result = pacmap_->ToJsonArrayFloat(array, item, type);
1546 EXPECT_EQ(result, false);
1547
1548 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayFloat_0100 end";
1549 }
1550
1551 /**
1552 * @tc.number: AppExecFwk_PacMap_ToJsonArrayDouble_0100
1553 * @tc.name: ToJsonArrayDouble
1554 * @tc.desc: Verify ToJsonArrayDouble.
1555 * @tc.require: issueI64N5S
1556 */
1557 HWTEST_F(PacMapTest, AppExecFwk_PacMap_ToJsonArrayDouble_0100, Function | MediumTest | Level1)
1558 {
1559 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayDouble_0100 start";
1560
1561 std::vector<double> array;
1562 Json::Value item;
1563 int type = 1;
1564 bool result = pacmap_->ToJsonArrayDouble(array, item, type);
1565 EXPECT_EQ(result, false);
1566
1567 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayDouble_0100 end";
1568 }
1569
1570 /**
1571 * @tc.number: AppExecFwk_PacMap_ToJsonArrayString_0100
1572 * @tc.name: ToJsonArrayString
1573 * @tc.desc: Verify ToJsonArrayString.
1574 * @tc.require: issueI64N5S
1575 */
1576 HWTEST_F(PacMapTest, AppExecFwk_PacMap_ToJsonArrayString_0100, Function | MediumTest | Level1)
1577 {
1578 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayString_0100 start";
1579
1580 std::vector<std::string> array;
1581 Json::Value item;
1582 int type = 1;
1583 bool result = pacmap_->ToJsonArrayString(array, item, type);
1584 EXPECT_EQ(result, false);
1585
1586 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ToJsonArrayString_0100 end";
1587 }
1588
1589 /**
1590 * @tc.number: AppExecFwk_PacMap_ParseJson_0100
1591 * @tc.name: ParseJson
1592 * @tc.desc: Verify ParseJson.
1593 * @tc.require: issueI64N5S
1594 */
1595 HWTEST_F(PacMapTest, AppExecFwk_PacMap_ParseJson_0100, Function | MediumTest | Level1)
1596 {
1597 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ParseJson_0100 start";
1598
1599 Json::Value data;
1600 PacMapList mapList;
1601 bool result = pacmap_->ParseJson(data, mapList);
1602 EXPECT_EQ(result, false);
1603
1604 GTEST_LOG_(INFO) << "AppExecFwk_PacMap_ParseJson_0100 end";
1605 }
1606
1607 /**
1608 * @tc.number: AppExecFwk_ParseJsonItemArrayShort_0100
1609 * @tc.name: ParseJsonItemArrayShort
1610 * @tc.desc: Verify ParseJsonItemArrayShort.
1611 * @tc.require: issueI64N5S
1612 */
1613 HWTEST_F(PacMapTest, AppExecFwk_ParseJsonItemArrayShort_0100, Function | MediumTest | Level1)
1614 {
1615 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayShort_0100 start";
1616
1617 PacMapList mapList;
1618 std::string key = "this is key";
1619 Json::Value item;
1620 bool result = pacmap_->ParseJsonItemArrayShort(mapList, key, item);
1621 EXPECT_EQ(result, true);
1622
1623 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayShort_0100 end";
1624 }
1625
1626 /**
1627 * @tc.number: AppExecFwk_ParseJsonItemArrayInteger_0100
1628 * @tc.name: ParseJsonItemArrayInteger
1629 * @tc.desc: Verify ParseJsonItemArrayInteger.
1630 * @tc.require: issueI64N5S
1631 */
1632 HWTEST_F(PacMapTest, AppExecFwk_ParseJsonItemArrayInteger_0100, Function | MediumTest | Level1)
1633 {
1634 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayInteger_0100 start";
1635
1636 PacMapList mapList;
1637 std::string key = "this is key";
1638 Json::Value item;
1639 bool result = pacmap_->ParseJsonItemArrayInteger(mapList, key, item);
1640 EXPECT_EQ(result, true);
1641
1642 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayInteger_0100 end";
1643 }
1644
1645 /**
1646 * @tc.number: AppExecFwk_ParseJsonItemArrayLong_0100
1647 * @tc.name: ParseJsonItemArrayLong
1648 * @tc.desc: Verify ParseJsonItemArrayLong.
1649 * @tc.require: issueI64N5S
1650 */
1651 HWTEST_F(PacMapTest, AppExecFwk_ParseJsonItemArrayLong_0100, Function | MediumTest | Level1)
1652 {
1653 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayLong_0100 start";
1654
1655 PacMapList mapList;
1656 std::string key = "this is key";
1657 Json::Value item;
1658 bool result = pacmap_->ParseJsonItemArrayLong(mapList, key, item);
1659 EXPECT_EQ(result, true);
1660
1661 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayLong_0100 end";
1662 }
1663
1664 /**
1665 * @tc.number: AppExecFwk_ParseJsonItemArrayChar_0100
1666 * @tc.name: ParseJsonItemArrayChar
1667 * @tc.desc: Verify ParseJsonItemArrayChar.
1668 * @tc.require: issueI64N5S
1669 */
1670 HWTEST_F(PacMapTest, AppExecFwk_ParseJsonItemArrayChar_0100, Function | MediumTest | Level1)
1671 {
1672 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayChar_0100 start";
1673
1674 PacMapList mapList;
1675 std::string key = "this is key";
1676 Json::Value item;
1677 bool result = pacmap_->ParseJsonItemArrayChar(mapList, key, item);
1678 EXPECT_EQ(result, true);
1679
1680 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayChar_0100 end";
1681 }
1682
1683 /**
1684 * @tc.number: AppExecFwk_ParseJsonItemArrayChar_0200
1685 * @tc.name: ParseJsonItemArrayChar
1686 * @tc.desc: Verify ParseJsonItemArrayChar.
1687 * @tc.require:
1688 */
1689 HWTEST_F(PacMapTest, AppExecFwk_ParseJsonItemArrayChar_0200, Function | MediumTest | Level1)
1690 {
1691 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayChar_0200 start";
1692
1693 PacMapList mapList;
1694 std::string key = "this is key";
1695 Json::Value item;
1696 item["data"] = "test";
1697 auto result = pacmap_->ParseJsonItemArrayChar(mapList, key, item);
1698 EXPECT_EQ(result, true);
1699
1700 Json::Value courses(Json::arrayValue);
1701 courses.append('a');
1702 courses.append(1);
1703 courses.append("first");
1704 courses.append("second");
1705 courses.append("third");
1706 item["data"] = courses;
1707 result = pacmap_->ParseJsonItemArrayChar(mapList, key, item);
1708 EXPECT_EQ(result, false);
1709
1710 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayChar_0200 end";
1711 }
1712
1713 /**
1714 * @tc.number: AppExecFwk_ParseJsonItemArrayByte_0100
1715 * @tc.name: ParseJsonItemArrayByte
1716 * @tc.desc: Verify ParseJsonItemArrayByte.
1717 * @tc.require: issueI64N5S
1718 */
1719 HWTEST_F(PacMapTest, AppExecFwk_ParseJsonItemArrayByte_0100, Function | MediumTest | Level1)
1720 {
1721 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayByte_0100 start";
1722
1723 PacMapList mapList;
1724 std::string key = "this is key";
1725 Json::Value item;
1726 bool result = pacmap_->ParseJsonItemArrayByte(mapList, key, item);
1727 EXPECT_EQ(result, true);
1728
1729 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayByte_0100 end";
1730 }
1731
1732 /**
1733 * @tc.number: AppExecFwk_ParseJsonItemArrayBoolean_0100
1734 * @tc.name: ParseJsonItemArrayBoolean
1735 * @tc.desc: Verify ParseJsonItemArrayBoolean.
1736 * @tc.require: issueI64N5S
1737 */
1738 HWTEST_F(PacMapTest, AppExecFwk_ParseJsonItemArrayBoolean_0100, Function | MediumTest | Level1)
1739 {
1740 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayBoolean_0100 start";
1741
1742 PacMapList mapList;
1743 std::string key = "this is key";
1744 Json::Value item;
1745 bool result = pacmap_->ParseJsonItemArrayBoolean(mapList, key, item);
1746 EXPECT_EQ(result, true);
1747
1748 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayBoolean_0100 end";
1749 }
1750
1751 /**
1752 * @tc.number: AppExecFwk_ParseJsonItemArrayFloat_0100
1753 * @tc.name: ParseJsonItemArrayFloat
1754 * @tc.desc: Verify ParseJsonItemArrayFloat.
1755 * @tc.require: issueI64N5S
1756 */
1757 HWTEST_F(PacMapTest, AppExecFwk_ParseJsonItemArrayFloat_0100, Function | MediumTest | Level1)
1758 {
1759 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayFloat_0100 start";
1760
1761 PacMapList mapList;
1762 std::string key = "this is key";
1763 Json::Value item;
1764 bool result = pacmap_->ParseJsonItemArrayFloat(mapList, key, item);
1765 EXPECT_EQ(result, true);
1766
1767 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayFloat_0100 end";
1768 }
1769
1770 /**
1771 * @tc.number: AppExecFwk_ParseJsonItemArrayDouble_0100
1772 * @tc.name: ParseJsonItemArrayDouble
1773 * @tc.desc: Verify ParseJsonItemArrayDouble.
1774 * @tc.require: issueI64N5S
1775 */
1776 HWTEST_F(PacMapTest, AppExecFwk_ParseJsonItemArrayDouble_0100, Function | MediumTest | Level1)
1777 {
1778 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayDouble_0100 start";
1779
1780 PacMapList mapList;
1781 std::string key = "this is key";
1782 Json::Value item;
1783 bool result = pacmap_->ParseJsonItemArrayDouble(mapList, key, item);
1784 EXPECT_EQ(result, true);
1785
1786 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayDouble_0100 end";
1787 }
1788
1789 /**
1790 * @tc.number: AppExecFwk_ParseJsonItemArrayString_0100
1791 * @tc.name: ParseJsonItemArrayString
1792 * @tc.desc: Verify ParseJsonItemArrayString.
1793 * @tc.require: issueI64N5S
1794 */
1795 HWTEST_F(PacMapTest, AppExecFwk_ParseJsonItemArrayString_0100, Function | MediumTest | Level1)
1796 {
1797 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayString_0100 start";
1798
1799 PacMapList mapList;
1800 std::string key = "this is key";
1801 Json::Value item;
1802 bool result = pacmap_->ParseJsonItemArrayString(mapList, key, item);
1803 EXPECT_EQ(result, true);
1804
1805 GTEST_LOG_(INFO) << "AppExecFwk_ParseJsonItemArrayString_0100 end";
1806 }
1807
1808 /**
1809 * @tc.number: AppExecFwk_InnerPutObjectValue_0100
1810 * @tc.name: InnerPutObjectValue
1811 * @tc.desc: Verify InnerPutObjectValue.
1812 * @tc.require: issueI64N5S
1813 */
1814 HWTEST_F(PacMapTest, AppExecFwk_InnerPutObjectValue_0100, Function | MediumTest | Level1)
1815 {
1816 GTEST_LOG_(INFO) << "AppExecFwk_InnerPutObjectValue_0100 start";
1817
1818 PacMapList mapList;
1819 std::string key = "this is key";
1820 Json::Value item;
1821 bool result = pacmap_->InnerPutObjectValue(mapList, key, item);
1822 EXPECT_EQ(result, false);
1823
1824 GTEST_LOG_(INFO) << "AppExecFwk_InnerPutObjectValue_0100 end";
1825 }
1826
1827 /**
1828 * @tc.number: AppExecFwk_InnerPutPacMapValue_0100
1829 * @tc.name: InnerPutPacMapValue
1830 * @tc.desc: Verify InnerPutPacMapValue.
1831 * @tc.require: issueI64N5S
1832 */
1833 HWTEST_F(PacMapTest, AppExecFwk_InnerPutPacMapValue_0100, Function | MediumTest | Level1)
1834 {
1835 GTEST_LOG_(INFO) << "AppExecFwk_InnerPutPacMapValue_0100 start";
1836
1837 PacMapList mapList;
1838 std::string key = "this is key";
1839 Json::Value item;
1840 bool result = pacmap_->InnerPutPacMapValue(mapList, key, item);
1841 EXPECT_EQ(result, false);
1842
1843 GTEST_LOG_(INFO) << "AppExecFwk_InnerPutPacMapValue_0100 end";
1844 }
1845 } // namespace AppExecFwk
1846 } // namespace OHOS
1847