• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 "attributes_test.h"
17 
18 #include <climits>
19 
20 #include "attributes.h"
21 
22 namespace OHOS {
23 namespace UserIam {
24 namespace UserAuth {
25 using namespace testing;
26 using namespace testing::ext;
27 
SetUpTestCase()28 void AttributesTest::SetUpTestCase()
29 {
30 }
31 
TearDownTestCase()32 void AttributesTest::TearDownTestCase()
33 {
34 }
35 
SetUp()36 void AttributesTest::SetUp()
37 {
38 }
39 
TearDown()40 void AttributesTest::TearDown()
41 {
42 }
43 
44 HWTEST_F(AttributesTest, AttributesInit, TestSize.Level0)
45 {
46     Attributes attrs;
47     EXPECT_EQ(attrs.Serialize().size(), 0U);
48 }
49 
50 HWTEST_F(AttributesTest, AttributesSerialize, TestSize.Level0)
51 {
52     const std::vector<Attributes::AttributeKey> desired = {Attributes::ATTR_RESULT_CODE, Attributes::ATTR_SIGNATURE,
53         Attributes::ATTR_TEMPLATE_ID_LIST, Attributes::ATTR_REMAIN_TIMES, Attributes::ATTR_FREEZING_TIME,
54         Attributes::ATTR_SCHEDULE_ID, Attributes::ATTR_SCHEDULE_MODE};
55 
56     Attributes attrs;
57 
58     EXPECT_TRUE(attrs.SetBoolValue(Attributes::ATTR_RESULT_CODE, true));
59     EXPECT_TRUE(attrs.SetBoolValue(Attributes::ATTR_SIGNATURE, false));
60     EXPECT_TRUE(attrs.SetUint64Value(Attributes::ATTR_SCHEDULE_ID, UINT64_MAX));
61     EXPECT_TRUE(attrs.SetUint32ArrayValue(Attributes::ATTR_REMAIN_TIMES, {1, 3, 5, 7, 9}));
62     EXPECT_TRUE(attrs.SetUint32Value(Attributes::ATTR_SCHEDULE_MODE, UINT32_MAX));
63     EXPECT_TRUE(attrs.SetUint64ArrayValue(Attributes::ATTR_FREEZING_TIME, {2, 4, 6, 8, 10}));
64     EXPECT_TRUE(attrs.SetStringValue(Attributes::ATTR_TEMPLATE_ID_LIST, "iam"));
65 
66     EXPECT_THAT(attrs.GetKeys(), ElementsAreArray(desired));
67     auto buff = attrs.Serialize();
68     Attributes attrs2(buff);
69     EXPECT_THAT(attrs2.GetKeys(), ElementsAreArray(desired));
70 
71     {
72         bool value;
73         EXPECT_TRUE(attrs2.GetBoolValue(Attributes::ATTR_RESULT_CODE, value));
74         EXPECT_EQ(value, true);
75     }
76     {
77         bool value;
78         EXPECT_TRUE(attrs2.GetBoolValue(Attributes::ATTR_SIGNATURE, value));
79         EXPECT_EQ(value, false);
80     }
81     {
82         uint64_t value;
83         EXPECT_TRUE(attrs2.GetUint64Value(Attributes::ATTR_SCHEDULE_ID, value));
84         EXPECT_EQ(value, UINT64_MAX);
85     }
86     {
87         std::vector<uint32_t> value;
88         EXPECT_TRUE(attrs2.GetUint32ArrayValue(Attributes::ATTR_REMAIN_TIMES, value));
89         EXPECT_THAT(value, ElementsAre(1, 3, 5, 7, 9));
90     }
91     {
92         uint32_t value;
93         EXPECT_TRUE(attrs2.GetUint32Value(Attributes::ATTR_SCHEDULE_MODE, value));
94         EXPECT_EQ(value, UINT32_MAX);
95     }
96     {
97         std::vector<uint64_t> value;
98         EXPECT_TRUE(attrs2.GetUint64ArrayValue(Attributes::ATTR_FREEZING_TIME, value));
99         EXPECT_THAT(value, ElementsAre(2, 4, 6, 8, 10));
100     }
101     {
102         std::string value;
103         EXPECT_TRUE(attrs2.GetStringValue(Attributes::ATTR_TEMPLATE_ID_LIST, value));
104         EXPECT_EQ(value, "iam");
105     }
106 }
107 
108 HWTEST_F(AttributesTest, AttributesBoolValue, TestSize.Level0)
109 {
110     Attributes attrs;
111     EXPECT_TRUE(attrs.SetBoolValue(Attributes::ATTR_RESULT_CODE, true));
112     EXPECT_TRUE(attrs.SetBoolValue(Attributes::ATTR_SIGNATURE, false));
113 
114     bool value1;
115     bool value2;
116     EXPECT_TRUE(attrs.GetBoolValue(Attributes::ATTR_RESULT_CODE, value1));
117     EXPECT_TRUE(attrs.GetBoolValue(Attributes::ATTR_SIGNATURE, value2));
118     EXPECT_TRUE(value1);
119     EXPECT_FALSE(value2);
120 }
121 
122 HWTEST_F(AttributesTest, AttributesUint64Value, TestSize.Level0)
123 {
124     Attributes attrs;
125     EXPECT_TRUE(attrs.SetUint64Value(Attributes::ATTR_RESULT_CODE, UINT32_MAX));
126     EXPECT_TRUE(attrs.SetUint64Value(Attributes::ATTR_SIGNATURE, UINT64_MAX));
127 
128     uint64_t value1;
129     uint64_t value2;
130     EXPECT_TRUE(attrs.GetUint64Value(Attributes::ATTR_RESULT_CODE, value1));
131     EXPECT_TRUE(attrs.GetUint64Value(Attributes::ATTR_SIGNATURE, value2));
132     EXPECT_EQ(value1, UINT32_MAX);
133     EXPECT_EQ(value2, UINT64_MAX);
134 }
135 
136 HWTEST_F(AttributesTest, AttributesUint32Value, TestSize.Level0)
137 {
138     Attributes attrs;
139     EXPECT_TRUE(attrs.SetUint32Value(Attributes::ATTR_RESULT_CODE, UINT16_MAX));
140     EXPECT_TRUE(attrs.SetUint32Value(Attributes::ATTR_SIGNATURE, UINT32_MAX));
141 
142     uint32_t value1;
143     uint32_t value2;
144     EXPECT_TRUE(attrs.GetUint32Value(Attributes::ATTR_RESULT_CODE, value1));
145     EXPECT_TRUE(attrs.GetUint32Value(Attributes::ATTR_SIGNATURE, value2));
146     EXPECT_TRUE(value1 == UINT16_MAX);
147     EXPECT_TRUE(value2 == UINT32_MAX);
148 }
149 
150 HWTEST_F(AttributesTest, AttributesUint16Value, TestSize.Level0)
151 {
152     Attributes attrs;
153     EXPECT_TRUE(attrs.SetUint16Value(Attributes::ATTR_RESULT_CODE, UINT8_MAX));
154     EXPECT_TRUE(attrs.SetUint16Value(Attributes::ATTR_SIGNATURE, UINT16_MAX));
155 
156     uint16_t value1;
157     uint16_t value2;
158     EXPECT_TRUE(attrs.GetUint16Value(Attributes::ATTR_RESULT_CODE, value1));
159     EXPECT_TRUE(attrs.GetUint16Value(Attributes::ATTR_SIGNATURE, value2));
160     EXPECT_TRUE(value1 == UINT8_MAX);
161     EXPECT_TRUE(value2 == UINT16_MAX);
162 }
163 
164 HWTEST_F(AttributesTest, AttributesUint8Value, TestSize.Level0)
165 {
166     Attributes attrs;
167     EXPECT_TRUE(attrs.SetUint8Value(Attributes::ATTR_RESULT_CODE, 0));
168     EXPECT_TRUE(attrs.SetUint8Value(Attributes::ATTR_SIGNATURE, UINT8_MAX));
169 
170     uint8_t value1;
171     uint8_t value2;
172     EXPECT_TRUE(attrs.GetUint8Value(Attributes::ATTR_RESULT_CODE, value1));
173     EXPECT_TRUE(attrs.GetUint8Value(Attributes::ATTR_SIGNATURE, value2));
174     EXPECT_EQ(value1, 0);
175     EXPECT_EQ(value2, UINT8_MAX);
176 }
177 
178 HWTEST_F(AttributesTest, AttributesStringValue, TestSize.Level0)
179 {
180     Attributes attrs;
181     EXPECT_TRUE(attrs.SetStringValue(Attributes::ATTR_RESULT_CODE, "hello iam"));
182     EXPECT_TRUE(attrs.SetStringValue(Attributes::ATTR_SIGNATURE, ""));
183 
184     std::string value1;
185     std::string value2;
186     EXPECT_TRUE(attrs.GetStringValue(Attributes::ATTR_RESULT_CODE, value1));
187     EXPECT_TRUE(attrs.GetStringValue(Attributes::ATTR_SIGNATURE, value2));
188     EXPECT_EQ(value1, "hello iam");
189     EXPECT_EQ(value2, "");
190 }
191 
192 HWTEST_F(AttributesTest, AttributesUint64ByteArray, TestSize.Level0)
193 {
194     {
195         constexpr int SIZE = 8192;
196 
197         Attributes attrs;
198         std::vector<uint64_t> array;
199         array.reserve(SIZE);
200         for (int i = 0; i < SIZE; i++) {
201             array.push_back(UINT64_MAX - i);
202         }
203         EXPECT_TRUE(attrs.SetUint64ArrayValue(Attributes::ATTR_FREEZING_TIME, array));
204 
205         std::vector<uint64_t> out;
206         EXPECT_TRUE(attrs.GetUint64ArrayValue(Attributes::ATTR_FREEZING_TIME, out));
207         EXPECT_THAT(out, ElementsAreArray(array));
208     }
209 
210     {
211         Attributes attrs;
212         std::vector<uint64_t> array;
213         EXPECT_TRUE(attrs.SetUint64ArrayValue(Attributes::ATTR_FREEZING_TIME, array));
214         EXPECT_TRUE(attrs.GetUint64ArrayValue(Attributes::ATTR_FREEZING_TIME, array));
215         EXPECT_TRUE(array.empty());
216     }
217 }
218 
219 HWTEST_F(AttributesTest, AttributesUint32ByteArray, TestSize.Level0)
220 {
221     {
222         constexpr int SIZE = 8192;
223 
224         Attributes attrs;
225         std::vector<uint32_t> array;
226         array.reserve(SIZE);
227         for (int i = 0; i < SIZE; i++) {
228             array.push_back(UINT32_MAX - i);
229         }
230         EXPECT_TRUE(attrs.SetUint32ArrayValue(Attributes::ATTR_FREEZING_TIME, array));
231 
232         std::vector<uint32_t> out;
233         EXPECT_TRUE(attrs.GetUint32ArrayValue(Attributes::ATTR_FREEZING_TIME, out));
234         EXPECT_THAT(out, ElementsAreArray(array));
235     }
236     {
237         Attributes attrs;
238         std::vector<uint32_t> array;
239         EXPECT_TRUE(attrs.SetUint32ArrayValue(Attributes::ATTR_FREEZING_TIME, array));
240 
241         EXPECT_TRUE(attrs.GetUint32ArrayValue(Attributes::ATTR_FREEZING_TIME, array));
242         EXPECT_TRUE(array.empty());
243     }
244 }
245 
246 HWTEST_F(AttributesTest, AttributesUint16ByteArray, TestSize.Level0)
247 {
248     {
249         constexpr int SIZE = 8192;
250 
251         Attributes attrs;
252         std::vector<uint16_t> array;
253         array.reserve(SIZE);
254         for (int i = 0; i < SIZE; i++) {
255             array.push_back(UINT16_MAX - i);
256         }
257         EXPECT_TRUE(attrs.SetUint16ArrayValue(Attributes::ATTR_FREEZING_TIME, array));
258 
259         std::vector<uint16_t> out;
260         EXPECT_TRUE(attrs.GetUint16ArrayValue(Attributes::ATTR_FREEZING_TIME, out));
261         EXPECT_THAT(out, ElementsAreArray(array));
262     }
263     {
264         Attributes attrs;
265         std::vector<uint16_t> array;
266         EXPECT_TRUE(attrs.SetUint16ArrayValue(Attributes::ATTR_FREEZING_TIME, array));
267 
268         EXPECT_TRUE(attrs.GetUint16ArrayValue(Attributes::ATTR_FREEZING_TIME, array));
269         EXPECT_TRUE(array.empty());
270     }
271 }
272 
273 HWTEST_F(AttributesTest, AttributesUint8ByteArray, TestSize.Level0)
274 {
275     {
276         constexpr int SIZE = 8192;
277 
278         Attributes attrs;
279         std::vector<uint8_t> array;
280         array.reserve(SIZE);
281         for (int i = 0; i < SIZE; i++) {
282             array.push_back(i);
283         }
284         EXPECT_TRUE(attrs.SetUint8ArrayValue(Attributes::ATTR_FREEZING_TIME, array));
285 
286         std::vector<uint8_t> out;
287         EXPECT_TRUE(attrs.GetUint8ArrayValue(Attributes::ATTR_FREEZING_TIME, out));
288         EXPECT_THAT(out, ElementsAreArray(array));
289     }
290     {
291         Attributes attrs;
292         std::vector<uint8_t> array;
293         EXPECT_TRUE(attrs.SetUint8ArrayValue(Attributes::ATTR_FREEZING_TIME, array));
294 
295         EXPECT_TRUE(attrs.GetUint8ArrayValue(Attributes::ATTR_FREEZING_TIME, array));
296         EXPECT_TRUE(array.empty());
297     }
298 }
299 
300 HWTEST_F(AttributesTest, AttributesDeserialize, TestSize.Level0)
301 {
302     const std::vector<Attributes::AttributeKey> desired = {Attributes::ATTR_RESULT_CODE, Attributes::ATTR_SIGNATURE,
303         Attributes::ATTR_TEMPLATE_ID_LIST, Attributes::ATTR_REMAIN_TIMES, Attributes::ATTR_FREEZING_TIME,
304         Attributes::ATTR_SCHEDULE_ID, Attributes::ATTR_SCHEDULE_MODE};
305 
306     const std::vector<uint8_t> raw = {161, 134, 1, 0, 1, 0, 0, 0, 1, 164, 134, 1, 0, 1, 0, 0, 0, 0, 167, 134, 1, 0, 4,
307         0, 0, 0, 105, 97, 109, 0, 169, 134, 1, 0, 20, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 5, 0, 0, 0, 7, 0, 0, 0, 9, 0, 0,
308         0, 170, 134, 1, 0, 40, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0,
309         0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 180, 134, 1, 0, 8, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 182,
310         134, 1, 0, 4, 0, 0, 0, 255, 255, 255, 255};
311 
312     Attributes attrs(raw);
313     EXPECT_THAT(attrs.GetKeys(), ElementsAreArray(desired));
314     {
315         bool value;
316         EXPECT_TRUE(attrs.GetBoolValue(Attributes::ATTR_RESULT_CODE, value));
317         EXPECT_EQ(value, true);
318     }
319     {
320         bool value;
321         EXPECT_TRUE(attrs.GetBoolValue(Attributes::ATTR_SIGNATURE, value));
322         EXPECT_EQ(value, false);
323     }
324     {
325         uint64_t value;
326         EXPECT_TRUE(attrs.GetUint64Value(Attributes::ATTR_SCHEDULE_ID, value));
327         EXPECT_EQ(value, UINT64_MAX);
328     }
329     {
330         std::vector<uint32_t> value;
331         EXPECT_TRUE(attrs.GetUint32ArrayValue(Attributes::ATTR_REMAIN_TIMES, value));
332         EXPECT_THAT(value, ElementsAre(1, 3, 5, 7, 9));
333     }
334     {
335         uint32_t value;
336         EXPECT_TRUE(attrs.GetUint32Value(Attributes::ATTR_SCHEDULE_MODE, value));
337         EXPECT_EQ(value, UINT32_MAX);
338     }
339     {
340         std::vector<uint64_t> value;
341         EXPECT_TRUE(attrs.GetUint64ArrayValue(Attributes::ATTR_FREEZING_TIME, value));
342         EXPECT_THAT(value, ElementsAre(2, 4, 6, 8, 10));
343     }
344     {
345         std::string value;
346         EXPECT_TRUE(attrs.GetStringValue(Attributes::ATTR_TEMPLATE_ID_LIST, value));
347         EXPECT_EQ(value, "iam");
348     }
349 }
350 
351 HWTEST_F(AttributesTest, AttributesInAttribute, TestSize.Level0)
352 {
353     const std::vector<uint8_t> raw = {161, 134, 1, 0, 1, 0, 0, 0, 1, 164, 134, 1, 0, 1, 0, 0, 0, 0, 167, 134, 1, 0, 4,
354         0, 0, 0, 105, 97, 109, 0, 169, 134, 1, 0, 20, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 5, 0, 0, 0, 7, 0, 0, 0, 9, 0, 0,
355         0, 170, 134, 1, 0, 40, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0,
356         0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 180, 134, 1, 0, 8, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 182,
357         134, 1, 0, 4, 0, 0, 0, 255, 255, 255, 255};
358 
359     Attributes attrs1;
360     EXPECT_TRUE(attrs1.SetBoolValue(Attributes::ATTR_RESULT_CODE, true));
361     EXPECT_TRUE(attrs1.SetBoolValue(Attributes::ATTR_SIGNATURE, false));
362     EXPECT_TRUE(attrs1.SetUint64Value(Attributes::ATTR_SCHEDULE_ID, UINT64_MAX));
363     EXPECT_TRUE(attrs1.SetUint32ArrayValue(Attributes::ATTR_REMAIN_TIMES, {1, 3, 5, 7, 9}));
364     EXPECT_TRUE(attrs1.SetUint32Value(Attributes::ATTR_SCHEDULE_MODE, UINT32_MAX));
365     EXPECT_TRUE(attrs1.SetUint64ArrayValue(Attributes::ATTR_FREEZING_TIME, {2, 4, 6, 8, 10}));
366     EXPECT_TRUE(attrs1.SetStringValue(Attributes::ATTR_TEMPLATE_ID_LIST, "iam"));
367 
368     Attributes attrs2;
369     EXPECT_TRUE(attrs2.SetAttributesValue(Attributes::ATTR_RESULT_CODE, attrs1));
370 
371     Attributes attrs3(attrs2.Serialize());
372 
373     Attributes attrs4;
374     EXPECT_TRUE(attrs3.GetAttributesValue(Attributes::ATTR_RESULT_CODE, attrs4));
375     EXPECT_THAT(attrs4.Serialize(), ElementsAreArray(raw));
376 }
377 
378 HWTEST_F(AttributesTest, AttributesDeserializeMismatch, TestSize.Level0)
379 {
380     const std::vector<uint8_t> raw = {0, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0, 0, 20, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 5, 0,
381         0, 0, 7, 0, 0, 0, 9, 0, 0, 0, 3, 0, 0, 0, 40, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0,
382         0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0,
383         0, 255, 255, 255, 255, 6, 0, 0, 0, 8, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 7, 0, 0, 0, 4, 0, 0, 0,
384         105, 97, 109, 0};
385 
386     Attributes attrs(raw);
387     {
388         bool value;
389         EXPECT_FALSE(attrs.GetBoolValue(Attributes::ATTR_TEMPLATE_ID_LIST, value));
390     }
391     {
392         uint16_t value;
393         EXPECT_FALSE(attrs.GetUint16Value(Attributes::ATTR_TEMPLATE_ID_LIST, value));
394     }
395 }
396 
397 HWTEST_F(AttributesTest, AttributesEmptyArrays, TestSize.Level0)
398 {
399     Attributes attrs1;
400     {
401         bool value = true;
402         EXPECT_TRUE(attrs1.SetBoolValue(Attributes::ATTR_RESULT_CODE, value));
403     }
404     {
405         std::vector<uint64_t> value;
406         EXPECT_TRUE(attrs1.SetUint64ArrayValue(Attributes::ATTR_SCHEDULE_ID, value));
407     }
408     {
409         std::vector<uint32_t> value;
410         EXPECT_TRUE(attrs1.SetUint32ArrayValue(Attributes::ATTR_REMAIN_TIMES, value));
411     }
412     {
413         std::vector<uint16_t> value;
414         EXPECT_TRUE(attrs1.SetUint16ArrayValue(Attributes::ATTR_TEMPLATE_ID_LIST, value));
415     }
416     {
417         std::vector<uint8_t> value;
418         EXPECT_TRUE(attrs1.SetUint8ArrayValue(Attributes::ATTR_FREEZING_TIME, value));
419     }
420 
421     auto buff = attrs1.Serialize();
422     EXPECT_FALSE(buff.empty());
423     Attributes attrs2(buff);
424 
425     {
426         bool value = false;
427         EXPECT_TRUE(attrs1.GetBoolValue(Attributes::ATTR_RESULT_CODE, value));
428         EXPECT_TRUE(value);
429     }
430     {
431         std::vector<uint64_t> value;
432         EXPECT_TRUE(attrs1.GetUint64ArrayValue(Attributes::ATTR_SCHEDULE_ID, value));
433         EXPECT_THAT(value, IsEmpty());
434     }
435     {
436         std::vector<uint32_t> value;
437         EXPECT_TRUE(attrs1.GetUint32ArrayValue(Attributes::ATTR_REMAIN_TIMES, value));
438         EXPECT_THAT(value, IsEmpty());
439     }
440     {
441         std::vector<uint16_t> value;
442         EXPECT_TRUE(attrs1.GetUint16ArrayValue(Attributes::ATTR_TEMPLATE_ID_LIST, value));
443         EXPECT_THAT(value, IsEmpty());
444     }
445     {
446         std::vector<uint8_t> value;
447         EXPECT_TRUE(attrs1.GetUint8ArrayValue(Attributes::ATTR_FREEZING_TIME, value));
448         EXPECT_THAT(value, IsEmpty());
449     }
450 }
451 
452 HWTEST_F(AttributesTest, AttributesCopyAndMove, TestSize.Level0)
453 {
454     EXPECT_FALSE(std::is_copy_assignable<Attributes>::value);
455     EXPECT_FALSE(std::is_copy_constructible<Attributes>::value);
456 
457     const std::vector<uint8_t> raw = {0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 255,
458         255, 255, 255, 3, 0, 0, 0, 8, 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 4, 0, 0, 0, 4, 0, 0, 0, 105, 97,
459         109, 0, 5, 0, 0, 0, 20, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 5, 0, 0, 0, 7, 0, 0, 0, 9, 0, 0, 0, 6, 0, 0, 0, 40, 0,
460         0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0,
461         0, 0, 0, 0, 0};
462     Attributes attrs1(raw);
463 
464     EXPECT_THAT(attrs1.Serialize(), ElementsAreArray(raw));
465 
466     Attributes attrs2 = std::move(attrs1);
467 
468     EXPECT_EQ(attrs1.Serialize().size(), 0U);
469     EXPECT_THAT(attrs2.Serialize(), ElementsAreArray(raw));
470 }
471 } // namespace UserAuth
472 } // namespace UserIam
473 } // namespace OHOS
474