1 /*
2 * Copyright (c) 2021-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 #define private public
16 #define protected public
17 #include "matching_skills.h"
18 #undef private
19 #undef protected
20
21 #include "testConfigParser.h"
22
23 #include <gtest/gtest.h>
24
25 using namespace testing::ext;
26
27 namespace OHOS {
28 namespace EventFwk {
29 class ActsCESMatchingSkillsTest : public testing::Test {
30 public:
31 static void SetUpTestCase();
32 static void TearDownTestCase();
33 void SetUp();
34 void TearDown();
35
36 static StressTestLevel stLevel_;
37 };
38 StressTestLevel ActsCESMatchingSkillsTest::stLevel_ {};
39
SetUpTestCase()40 void ActsCESMatchingSkillsTest::SetUpTestCase()
41 {
42 TestConfigParser tcp;
43 tcp.ParseFromFile4StressTest(STRESS_TEST_CONFIG_FILE_PATH, stLevel_);
44 std::cout << "stress test level : "
45 << "AMS : " << stLevel_.AMSLevel << " "
46 << "BMS : " << stLevel_.BMSLevel << " "
47 << "CES : " << stLevel_.CESLevel << std::endl;
48 }
49
TearDownTestCase()50 void ActsCESMatchingSkillsTest::TearDownTestCase()
51 {}
52
SetUp()53 void ActsCESMatchingSkillsTest::SetUp()
54 {}
55
TearDown()56 void ActsCESMatchingSkillsTest::TearDown()
57 {}
58
59 /*
60 * @tc.number: CES_MatchingSkills_Entity_0100
61 * @tc.name: AddEntity、GetEntity、CountEntities、HasEntity and RemoveEntity
62 * @tc.desc: Verify the function of MatchingSkills entity: AddEntity、GetEntity、
63 * CountEntities、HasEntity and RemoveEntity
64 */
65 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Entity_0100, Function | MediumTest | Level1)
66 {
67 bool result = false;
68 std::string eventName = "entityTest";
69 std::string entity = "entity";
70 std::string entityRemove = "entityRemove";
71 MatchingSkills matchingSkills;
72 for (int i = 1; i <= stLevel_.CESLevel; i++) {
73 matchingSkills.AddEvent(eventName);
74 matchingSkills.AddEntity(entity);
75 matchingSkills.AddEntity(entityRemove);
76
77 EXPECT_EQ(entity, matchingSkills.GetEntity(0));
78 EXPECT_TRUE(matchingSkills.HasEvent(eventName));
79 EXPECT_EQ(false, entity == matchingSkills.GetEntity(1000));
80 if (matchingSkills.HasEntity(entity)) {
81 matchingSkills.RemoveEntity(entity);
82 }
83
84 EXPECT_EQ(1, matchingSkills.CountEntities());
85 EXPECT_FALSE(matchingSkills.HasEntity(entity));
86 matchingSkills.RemoveEntity(entityRemove);
87 if (matchingSkills.CountEntities() != 0) {
88 result = false;
89 GTEST_LOG_(INFO) << "CES_MatchingSkills_Entity_0100 failed, frequency: " << i;
90 break;
91 } else {
92 result = true;
93 }
94 matchingSkills.RemoveEvent(eventName);
95 }
96 if (result && stLevel_.CESLevel >= 1) {
97 GTEST_LOG_(INFO) << "CES_MatchingSkills_Entity_0100 stress level: " << stLevel_.CESLevel;
98 }
99 EXPECT_TRUE(result);
100 }
101
102 /*
103 * @tc.number: CES_MatchingSkills_Entity_0200
104 * @tc.name: AddEntity、GetEntity、CountEntities、HasEntity and RemoveEntity
105 * @tc.desc: Verify the function of MatchingSkills entity with different name of event and entity:
106 * AddEntity、GetEntity、CountEntities、HasEntity and RemoveEntity
107 */
108 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Entity_0200, Function | MediumTest | Level1)
109 {
110 bool result = false;
111 std::string eventName = "EventEntityTest";
112 std::string entity = "EventEntityTest";
113 std::string entityRemove = "EventEntityTestRemove";
114 MatchingSkills matchingSkills;
115 for (int i = 1; i <= stLevel_.CESLevel; i++) {
116 matchingSkills.AddEvent(eventName);
117 matchingSkills.AddEntity(entity);
118 matchingSkills.AddEntity(entityRemove);
119
120 EXPECT_EQ(entity, matchingSkills.GetEntity(0));
121 EXPECT_TRUE(matchingSkills.HasEvent(eventName));
122 EXPECT_EQ(false, entity == matchingSkills.GetEntity(1000));
123 if (matchingSkills.HasEntity(entity)) {
124 matchingSkills.RemoveEntity(entity);
125 }
126
127 EXPECT_EQ(1, matchingSkills.CountEntities());
128 EXPECT_FALSE(matchingSkills.HasEntity(entity));
129 matchingSkills.RemoveEntity(entityRemove);
130 if (matchingSkills.CountEntities() != 0) {
131 result = false;
132 GTEST_LOG_(INFO) << "CES_MatchingSkills_Entity_0200 failed, frequency: " << i;
133 break;
134 } else {
135 result = true;
136 }
137 matchingSkills.RemoveEvent(eventName);
138 }
139 if (result && stLevel_.CESLevel >= 1) {
140 GTEST_LOG_(INFO) << "CES_MatchingSkills_Entity_0200 stress level: " << stLevel_.CESLevel;
141 }
142 EXPECT_TRUE(result);
143 }
144
145 /*
146 * @tc.number: CES_MatchingSkills_Entity_0300
147 * @tc.name: AddEntity、GetEntity、CountEntities、HasEntity and RemoveEntity
148 * @tc.desc: Verify the function of MatchingSkills entity with different name of event and entity:
149 * AddEntity、GetEntity、CountEntities、HasEntity and RemoveEntity
150 */
151 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Entity_0300, Function | MediumTest | Level1)
152 {
153 bool result = false;
154 std::string eventName = "EventEntityTest2";
155 std::string entity = "EventEntityTes2t";
156 std::string entityRemove = "EventEntityTestRemove2";
157 MatchingSkills matchingSkills;
158 for (int i = 1; i <= stLevel_.CESLevel; i++) {
159 matchingSkills.AddEvent(eventName);
160 matchingSkills.AddEntity(entity);
161 matchingSkills.AddEntity(entityRemove);
162
163 EXPECT_EQ(entity, matchingSkills.GetEntity(0));
164 EXPECT_TRUE(matchingSkills.HasEvent(eventName));
165 EXPECT_EQ(false, entity == matchingSkills.GetEntity(1000));
166 EXPECT_EQ(true, "" == matchingSkills.GetEntity(1000));
167 if (matchingSkills.HasEntity(entity)) {
168 matchingSkills.RemoveEntity(entity);
169 }
170
171 EXPECT_EQ(1, matchingSkills.CountEntities());
172 EXPECT_FALSE(matchingSkills.HasEntity(entity));
173 matchingSkills.RemoveEntity(entityRemove);
174 if (matchingSkills.CountEntities() != 0) {
175 result = false;
176 GTEST_LOG_(INFO) << "CES_MatchingSkills_Entity_0300 failed, frequency: " << i;
177 break;
178 } else {
179 result = true;
180 }
181 matchingSkills.RemoveEvent(eventName);
182 }
183 if (result && stLevel_.CESLevel >= 1) {
184 GTEST_LOG_(INFO) << "CES_MatchingSkills_Entity_0300 stress level: " << stLevel_.CESLevel;
185 }
186 EXPECT_TRUE(result);
187 }
188
189 /*
190 * @tc.number: CES_MatchingSkills_Entity_0400
191 * @tc.name: AddEntity、GetEntity、CountEntities、HasEntity and RemoveEntity
192 * @tc.desc: Verify the function of MatchingSkills entity with different name of event and entity:
193 * AddEntity、GetEntity、CountEntities、HasEntity and RemoveEntity
194 */
195 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Entity_0400, Function | MediumTest | Level1)
196 {
197 bool result = false;
198 std::string eventName = "EventEntityTest3";
199 std::string eventName2 = "EventEntityTest4";
200 std::string eventName3 = "EventEntityTest5";
201 std::string eventName4 = "EventEntityTest6";
202 std::string eventName5 = "EventEntityTest7";
203 std::string entity = "EventEntityTest3";
204 std::string entityRemove = "EventEntityTestRemove3";
205 MatchingSkills matchingSkills;
206 for (int i = 1; i <= stLevel_.CESLevel; i++) {
207 matchingSkills.AddEvent(eventName);
208 matchingSkills.AddEvent(eventName2);
209 matchingSkills.AddEvent(eventName3);
210 matchingSkills.AddEvent(eventName4);
211 matchingSkills.AddEvent(eventName5);
212
213 matchingSkills.AddEntity(entity);
214 matchingSkills.AddEntity(entityRemove);
215
216 EXPECT_EQ(5, matchingSkills.CountEvent());
217 EXPECT_EQ(eventName4, matchingSkills.GetEvent(3));
218 EXPECT_EQ(entity, matchingSkills.GetEntity(0));
219 EXPECT_TRUE(matchingSkills.HasEvent(eventName));
220 EXPECT_EQ(false, entity == matchingSkills.GetEntity(1000));
221 EXPECT_EQ(true, "" == matchingSkills.GetEntity(1000));
222
223 if (matchingSkills.HasEntity(entity)) {
224 matchingSkills.RemoveEntity(entity);
225 }
226 EXPECT_EQ(1, matchingSkills.CountEntities());
227 EXPECT_FALSE(matchingSkills.HasEntity(entity));
228
229 matchingSkills.RemoveEntity(entityRemove);
230 if (matchingSkills.CountEntities() != 0) {
231 result = false;
232 GTEST_LOG_(INFO) << "CES_MatchingSkills_Entity_0400 failed, frequency: " << i;
233 break;
234 } else {
235 result = true;
236 }
237 matchingSkills.RemoveEvent(eventName);
238 matchingSkills.RemoveEvent(eventName2);
239 matchingSkills.RemoveEvent(eventName3);
240 matchingSkills.RemoveEvent(eventName4);
241 matchingSkills.RemoveEvent(eventName5);
242 }
243 if (result && stLevel_.CESLevel >= 1) {
244 GTEST_LOG_(INFO) << "CES_MatchingSkills_Entity_0400 stress level: " << stLevel_.CESLevel;
245 }
246 EXPECT_TRUE(result);
247 }
248
249 /*
250 * @tc.number: CES_MatchingSkills_Entity_0500
251 * @tc.name: AddEntity、GetEntity、CountEntities、HasEntity and RemoveEntity
252 * @tc.desc: Verify the function of MatchingSkills entity with different name of event and entity:
253 * AddEntity、GetEntity、CountEntities、HasEntity and RemoveEntity
254 */
255 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Entity_0500, Function | MediumTest | Level1)
256 {
257 bool result = false;
258 std::string eventName = "EventEntityTest3";
259 std::string eventName2 = "EventEntityTest4";
260 std::string eventName3 = "EventEntityTest5";
261 std::string eventName4 = "EventEntityTest6";
262 std::string eventName5 = "EventEntityTest7";
263 std::string eventName6 = "EventEntityTest8";
264 std::string eventName7 = "EventEntityTest9";
265 std::string eventName8 = "EventEntityTest10";
266 std::string eventName9 = "EventEntityTest11";
267 std::string eventName10 = "EventEntityTest12";
268 std::string entity = "EventEntityTest3";
269 std::string entityRemove = "EventEntityTestRemove3";
270 MatchingSkills matchingSkills;
271 for (int i = 1; i <= stLevel_.CESLevel; i++) {
272 matchingSkills.AddEvent(eventName);
273 matchingSkills.AddEvent(eventName2);
274 matchingSkills.AddEvent(eventName3);
275 matchingSkills.AddEvent(eventName4);
276 matchingSkills.AddEvent(eventName5);
277 matchingSkills.AddEvent(eventName6);
278 matchingSkills.AddEvent(eventName7);
279 matchingSkills.AddEvent(eventName8);
280 matchingSkills.AddEvent(eventName9);
281 matchingSkills.AddEvent(eventName10);
282
283 matchingSkills.AddEntity(entity);
284 matchingSkills.AddEntity(entityRemove);
285
286 EXPECT_EQ(10, matchingSkills.CountEvent());
287 EXPECT_EQ(eventName4, matchingSkills.GetEvent(3));
288 EXPECT_EQ(entityRemove, matchingSkills.GetEntity(1));
289 EXPECT_TRUE(matchingSkills.HasEvent(eventName));
290 EXPECT_EQ(false, entity == matchingSkills.GetEntity(1000));
291 EXPECT_EQ(true, "" == matchingSkills.GetEntity(1000));
292 if (matchingSkills.HasEntity(entity)) {
293 matchingSkills.RemoveEntity(entity);
294 }
295
296 EXPECT_EQ(1, matchingSkills.CountEntities());
297 EXPECT_FALSE(matchingSkills.HasEntity(entity));
298 matchingSkills.RemoveEntity(entityRemove);
299 if (matchingSkills.CountEntities() != 0) {
300 result = false;
301 GTEST_LOG_(INFO) << "CES_MatchingSkills_Entity_0500 failed, frequency: " << i;
302 break;
303 } else {
304 result = true;
305 }
306 matchingSkills.RemoveEvent(eventName);
307 matchingSkills.RemoveEvent(eventName2);
308 matchingSkills.RemoveEvent(eventName3);
309 matchingSkills.RemoveEvent(eventName4);
310 matchingSkills.RemoveEvent(eventName5);
311 matchingSkills.RemoveEvent(eventName6);
312 matchingSkills.RemoveEvent(eventName7);
313 matchingSkills.RemoveEvent(eventName8);
314 matchingSkills.RemoveEvent(eventName9);
315 matchingSkills.RemoveEvent(eventName10);
316 }
317 if (result && stLevel_.CESLevel >= 1) {
318 GTEST_LOG_(INFO) << "CES_MatchingSkills_Entity_0500 stress level: " << stLevel_.CESLevel;
319 }
320 EXPECT_TRUE(result);
321 }
322
323 /*
324 * @tc.number: CES_MatchingSkills_Scheme_0100
325 * @tc.name: AddScheme、GetScheme、CountSchemes、HasScheme and RemoveScheme
326 * @tc.desc: Verify the function of MatchingSkills scheme : AddScheme、GetScheme、
327 * CountSchemes、HasScheme and RemoveScheme
328 */
329 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Scheme_0100, Function | MediumTest | Level1)
330 {
331 bool result = false;
332 std::string eventName = "EventSchemeTest";
333 std::string shceme = "shceme";
334 MatchingSkills matchingSkills;
335 for (int i = 1; i <= stLevel_.CESLevel; i++) {
336 matchingSkills.AddScheme(shceme);
337 EXPECT_TRUE(matchingSkills.HasScheme(shceme));
338 EXPECT_EQ(shceme, matchingSkills.GetScheme(0));
339 EXPECT_EQ(false, shceme == matchingSkills.GetScheme(1000));
340 matchingSkills.RemoveScheme(shceme);
341 if (matchingSkills.CountSchemes() != 0) {
342 result = false;
343 GTEST_LOG_(INFO) << "CES_MatchingSkills_Scheme_0100 failed, frequency: " << i;
344 break;
345 } else {
346 result = true;
347 }
348 }
349 if (result && stLevel_.CESLevel >= 1) {
350 GTEST_LOG_(INFO) << "CES_MatchingSkills_Scheme_0100 stress level: " << stLevel_.CESLevel;
351 }
352 EXPECT_TRUE(result);
353 }
354
355 /*
356 * @tc.number: CES_MatchingSkills_Scheme_0200
357 * @tc.name: AddScheme、GetScheme、CountSchemes、HasScheme and RemoveScheme
358 * @tc.desc: Verify the function of MatchingSkills scheme : AddScheme、GetScheme、
359 * CountSchemes、HasScheme and RemoveScheme
360 */
361 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Scheme_0200, Function | MediumTest | Level1)
362 {
363 bool result = false;
364 std::string eventName = "EventSchemeTest2";
365 std::string shceme = "shceme2";
366 MatchingSkills matchingSkills;
367 for (int i = 1; i <= stLevel_.CESLevel; i++) {
368 matchingSkills.AddScheme(shceme);
369 EXPECT_TRUE(matchingSkills.HasScheme(shceme));
370 EXPECT_EQ(shceme, matchingSkills.GetScheme(0));
371 EXPECT_EQ(false, shceme == matchingSkills.GetScheme(1000));
372 matchingSkills.RemoveScheme(shceme);
373 if (matchingSkills.CountSchemes() != 0) {
374 result = false;
375 GTEST_LOG_(INFO) << "CES_MatchingSkills_Scheme_0200 failed, frequency: " << i;
376 break;
377 } else {
378 result = true;
379 }
380 }
381 if (result && stLevel_.CESLevel >= 1) {
382 GTEST_LOG_(INFO) << "CES_MatchingSkills_Scheme_0200 stress level: " << stLevel_.CESLevel;
383 }
384 EXPECT_TRUE(result);
385 }
386
387 /*
388 * @tc.number: CES_MatchingSkills_Scheme_0300
389 * @tc.name: AddScheme、GetScheme、CountSchemes、HasScheme and RemoveScheme
390 * @tc.desc: Verify the function of MatchingSkills scheme : AddScheme、GetScheme、
391 * CountSchemes、HasScheme and RemoveScheme
392 */
393 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Scheme_0300, Function | MediumTest | Level1)
394 {
395 bool result = false;
396 std::string eventName = "EventSchemeTest3";
397 std::string shceme = "shceme3";
398 MatchingSkills matchingSkills;
399 for (int i = 1; i <= stLevel_.CESLevel; i++) {
400 matchingSkills.AddScheme(shceme);
401 EXPECT_TRUE(matchingSkills.HasScheme(shceme));
402 EXPECT_EQ(shceme, matchingSkills.GetScheme(0));
403 EXPECT_EQ(false, shceme == matchingSkills.GetScheme(1000));
404 matchingSkills.RemoveScheme(shceme);
405 if (matchingSkills.CountSchemes() != 0) {
406 result = false;
407 GTEST_LOG_(INFO) << "CES_MatchingSkills_Scheme_0300 failed, frequency: " << i;
408 break;
409 } else {
410 result = true;
411 }
412 }
413 if (result && stLevel_.CESLevel >= 1) {
414 GTEST_LOG_(INFO) << "CES_MatchingSkills_Scheme_0300 stress level: " << stLevel_.CESLevel;
415 }
416 EXPECT_TRUE(result);
417 }
418
419 /*
420 * @tc.number: CES_MatchingSkills_Scheme_0400
421 * @tc.name: AddScheme、GetScheme、CountSchemes、HasScheme and RemoveScheme
422 * @tc.desc: Verify the function of MatchingSkills scheme : AddScheme、GetScheme、
423 * CountSchemes、HasScheme and RemoveScheme
424 */
425 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Scheme_0400, Function | MediumTest | Level1)
426 {
427 bool result = false;
428 std::string eventName = "EventSchemeTest2";
429 std::string shceme = "shceme2";
430 std::string shceme2 = "shceme3";
431 std::string shceme3 = "shceme4";
432 std::string shceme4 = "shceme5";
433 std::string shceme5 = "shceme6";
434 MatchingSkills matchingSkills;
435 for (int i = 1; i <= stLevel_.CESLevel; i++) {
436 matchingSkills.AddScheme(shceme);
437 matchingSkills.AddScheme(shceme2);
438 matchingSkills.AddScheme(shceme3);
439 matchingSkills.AddScheme(shceme4);
440 matchingSkills.AddScheme(shceme5);
441
442 EXPECT_TRUE(matchingSkills.HasScheme(shceme2));
443 EXPECT_EQ(shceme, matchingSkills.GetScheme(0));
444 EXPECT_EQ(false, shceme == matchingSkills.GetScheme(1000));
445 EXPECT_EQ(true, "" == matchingSkills.GetScheme(1000));
446 matchingSkills.RemoveScheme(shceme);
447
448 if (matchingSkills.CountSchemes() != 4) {
449 result = false;
450 GTEST_LOG_(INFO) << "CES_MatchingSkills_Scheme_0400 failed, frequency: " << i;
451 break;
452 } else {
453 result = true;
454 }
455 matchingSkills.RemoveScheme(shceme2);
456 matchingSkills.RemoveScheme(shceme3);
457 matchingSkills.RemoveScheme(shceme4);
458 matchingSkills.RemoveScheme(shceme5);
459 }
460 if (result && stLevel_.CESLevel >= 1) {
461 GTEST_LOG_(INFO) << "CES_MatchingSkills_Scheme_0400 stress level: " << stLevel_.CESLevel;
462 }
463 EXPECT_TRUE(result);
464 }
465
466 /*
467 * @tc.number: CES_MatchingSkills_Scheme_0500
468 * @tc.name: AddScheme、GetScheme、CountSchemes、HasScheme and RemoveScheme
469 * @tc.desc: Verify the function of MatchingSkills scheme : AddScheme、GetScheme、
470 * CountSchemes、HasScheme and RemoveScheme
471 */
472 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Scheme_0500, Function | MediumTest | Level1)
473 {
474 bool result = false;
475 std::string eventName = "EventSchemeTest2";
476 std::string shceme = "shceme2";
477 std::string shceme2 = "shceme3";
478 std::string shceme3 = "shceme4";
479 std::string shceme4 = "shceme5";
480 std::string shceme5 = "shceme6";
481 std::string shceme6 = "shceme7";
482 std::string shceme7 = "shceme8";
483 std::string shceme8 = "shceme9";
484 std::string shceme9 = "shceme10";
485 std::string shceme10 = "shceme11";
486 MatchingSkills matchingSkills;
487 for (int i = 1; i <= stLevel_.CESLevel; i++) {
488 matchingSkills.AddScheme(shceme);
489 matchingSkills.AddScheme(shceme2);
490 matchingSkills.AddScheme(shceme3);
491 matchingSkills.AddScheme(shceme4);
492 matchingSkills.AddScheme(shceme5);
493 matchingSkills.AddScheme(shceme6);
494 matchingSkills.AddScheme(shceme7);
495 matchingSkills.AddScheme(shceme8);
496 matchingSkills.AddScheme(shceme9);
497 matchingSkills.AddScheme(shceme10);
498
499 EXPECT_TRUE(matchingSkills.HasScheme(shceme2));
500 EXPECT_EQ(shceme, matchingSkills.GetScheme(0));
501 EXPECT_EQ(shceme10, matchingSkills.GetScheme(9));
502 EXPECT_EQ(false, shceme == matchingSkills.GetScheme(1000));
503 EXPECT_EQ(true, "" == matchingSkills.GetScheme(1000));
504 matchingSkills.RemoveScheme(shceme);
505
506 if (matchingSkills.CountSchemes() != 9) {
507 result = false;
508 GTEST_LOG_(INFO) << "CES_MatchingSkills_Scheme_0500 failed, frequency: " << i;
509 break;
510 } else {
511 result = true;
512 }
513 matchingSkills.RemoveScheme(shceme2);
514 matchingSkills.RemoveScheme(shceme3);
515 matchingSkills.RemoveScheme(shceme4);
516 matchingSkills.RemoveScheme(shceme5);
517 matchingSkills.RemoveScheme(shceme6);
518 matchingSkills.RemoveScheme(shceme7);
519 matchingSkills.RemoveScheme(shceme8);
520 matchingSkills.RemoveScheme(shceme9);
521 matchingSkills.RemoveScheme(shceme10);
522 }
523 if (result && stLevel_.CESLevel >= 1) {
524 GTEST_LOG_(INFO) << "CES_MatchingSkills_Scheme_0500 stress level: " << stLevel_.CESLevel;
525 }
526 EXPECT_TRUE(result);
527 }
528
529 /*
530 * @tc.number: CES_MatchingSkills_MatchEvent_0100
531 * @tc.name: MatchEvent and AddEvent
532 * @tc.desc: Verify the function of MatchingSkills event : MatchEvent、AddEvent
533 */
534 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchEvent_0100, Function | MediumTest | Level1)
535 {
536 bool result = false;
537 MatchingSkills matchingSkills;
538 std::string eventName = "matchEvent";
539 for (int i = 1; i <= stLevel_.CESLevel; i++) {
540 EXPECT_FALSE(matchingSkills.MatchEvent(""));
541 matchingSkills.AddEvent(eventName);
542 if (!matchingSkills.MatchEvent(eventName)) {
543 result = false;
544 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEvent_0100 failed, frequency: " << i;
545 break;
546 } else {
547 result = true;
548 }
549 matchingSkills.RemoveEvent(eventName);
550 }
551 if (result && stLevel_.CESLevel >= 1) {
552 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEvent_0100 stress level: " << stLevel_.CESLevel;
553 }
554 EXPECT_TRUE(result);
555 }
556
557 /*
558 * @tc.number: CES_MatchingSkills_MatchEvent_0200
559 * @tc.name: MatchEvent and AddEvent
560 * @tc.desc: Verify the function of MatchingSkills event : MatchEvent、AddEvent
561 */
562 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchEvent_0200, Function | MediumTest | Level1)
563 {
564 bool result = false;
565 MatchingSkills matchingSkills;
566 std::string eventName = "matchEvent2";
567 for (int i = 1; i <= stLevel_.CESLevel; i++) {
568 EXPECT_FALSE(matchingSkills.MatchEvent(""));
569 matchingSkills.AddEvent(eventName);
570 if (!matchingSkills.MatchEvent(eventName)) {
571 result = false;
572 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEvent_0200 failed, frequency: " << i;
573 break;
574 } else {
575 result = true;
576 }
577 matchingSkills.RemoveEvent(eventName);
578 }
579 if (result && stLevel_.CESLevel >= 1) {
580 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEvent_0200 stress level: " << stLevel_.CESLevel;
581 }
582 EXPECT_TRUE(result);
583 }
584
585 /*
586 * @tc.number: CES_MatchingSkills_MatchEvent_0300
587 * @tc.name: MatchEvent and AddEvent
588 * @tc.desc: Verify the function of MatchingSkills event : MatchEvent、AddEvent
589 */
590 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchEvent_0300, Function | MediumTest | Level1)
591 {
592 bool result = false;
593 MatchingSkills matchingSkills;
594 std::string eventName = "matchEvent3";
595 for (int i = 1; i <= stLevel_.CESLevel; i++) {
596 EXPECT_FALSE(matchingSkills.MatchEvent(""));
597 matchingSkills.AddEvent(eventName);
598 if (!matchingSkills.MatchEvent(eventName)) {
599 result = false;
600 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEvent_0300 failed, frequency: " << i;
601 break;
602 } else {
603 result = true;
604 }
605 matchingSkills.RemoveEvent(eventName);
606 }
607 if (result && stLevel_.CESLevel >= 1) {
608 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEvent_0300 stress level: " << stLevel_.CESLevel;
609 }
610 EXPECT_TRUE(result);
611 }
612
613 /*
614 * @tc.number: CES_MatchingSkills_MatchEvent_0400
615 * @tc.name: MatchEvent and AddEvent
616 * @tc.desc: Verify the function of MatchingSkills event : MatchEvent、AddEvent
617 */
618 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchEvent_0400, Function | MediumTest | Level1)
619 {
620 bool result = false;
621 MatchingSkills matchingSkills;
622 std::string eventName = "matchEvent4";
623 for (int i = 1; i <= stLevel_.CESLevel; i++) {
624 EXPECT_FALSE(matchingSkills.MatchEvent(""));
625 matchingSkills.AddEvent(eventName);
626 if (!matchingSkills.MatchEvent(eventName)) {
627 result = false;
628 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEvent_0400 failed, frequency: " << i;
629 break;
630 } else {
631 result = true;
632 }
633 matchingSkills.RemoveEvent(eventName);
634 }
635 if (result && stLevel_.CESLevel >= 1) {
636 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEvent_0400 stress level: " << stLevel_.CESLevel;
637 }
638 EXPECT_TRUE(result);
639 }
640
641 /*
642 * @tc.number: CES_MatchingSkills_MatchEvent_0500
643 * @tc.name: MatchEvent and AddEvent
644 * @tc.desc: Verify the function of MatchingSkills event : MatchEvent、AddEvent
645 */
646 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchEvent_0500, Function | MediumTest | Level1)
647 {
648 bool result = false;
649 MatchingSkills matchingSkills;
650 std::string eventName = "matchEvent5";
651 for (int i = 1; i <= stLevel_.CESLevel; i++) {
652 EXPECT_FALSE(matchingSkills.MatchEvent(""));
653 matchingSkills.AddEvent(eventName);
654 if (!matchingSkills.MatchEvent(eventName)) {
655 result = false;
656 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEvent_0500 failed, frequency: " << i;
657 break;
658 } else {
659 result = true;
660 }
661 matchingSkills.RemoveEvent(eventName);
662 }
663 if (result && stLevel_.CESLevel >= 1) {
664 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEvent_0500 stress level: " << stLevel_.CESLevel;
665 }
666 EXPECT_TRUE(result);
667 }
668
669 /*
670 * @tc.number: CES_MatchingSkills_MatchEntity_0100
671 * @tc.name: MatchEntity and AddEntity
672 * @tc.desc: Verify the function of MatchingSkills entity : MatchEntity、AddEntity
673 */
674 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchEntity_0100, Function | MediumTest | Level1)
675 {
676 bool result = false;
677 MatchingSkills matchingSkills;
678 std::vector<std::string> entityVector;
679 std::string entity = "matchEntity";
680 for (int i = 1; i <= stLevel_.CESLevel; i++) {
681 EXPECT_TRUE(matchingSkills.MatchEntity(entityVector));
682 matchingSkills.AddEntity(entity);
683 entityVector.emplace_back(entity);
684 EXPECT_TRUE(matchingSkills.MatchEntity(entityVector));
685 entityVector.emplace_back("entityTestMatchEntity");
686 if (matchingSkills.MatchEntity(entityVector)) {
687 result = false;
688 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEntity_0100 failed, frequency: " << i;
689 break;
690 } else {
691 result = true;
692 }
693 entityVector.clear();
694 matchingSkills.RemoveEntity(entity);
695 }
696 if (result && stLevel_.CESLevel >= 1) {
697 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEntity_0100 stress level: " << stLevel_.CESLevel;
698 }
699 EXPECT_TRUE(result);
700 }
701
702 /*
703 * @tc.number: CES_MatchingSkills_MatchEntity_0200
704 * @tc.name: MatchEntity and AddEntity
705 * @tc.desc: Verify the function of MatchingSkills entity : MatchEntity、AddEntity
706 */
707 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchEntity_0200, Function | MediumTest | Level1)
708 {
709 bool result = false;
710 MatchingSkills matchingSkills;
711 std::vector<std::string> entityVector;
712 std::string entity = "matchEntity2";
713 for (int i = 1; i <= stLevel_.CESLevel; i++) {
714 EXPECT_TRUE(matchingSkills.MatchEntity(entityVector));
715 matchingSkills.AddEntity(entity);
716 entityVector.emplace_back(entity);
717 EXPECT_TRUE(matchingSkills.MatchEntity(entityVector));
718
719 entityVector.emplace_back("entityTestMatchEntity2");
720 if (matchingSkills.MatchEntity(entityVector)) {
721 result = false;
722 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEntity_0200 failed, frequency: " << i;
723 break;
724 } else {
725 result = true;
726 }
727 matchingSkills.RemoveEntity(entity);
728 entityVector.clear();
729 }
730 if (result && stLevel_.CESLevel >= 1) {
731 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEntity_0200 stress level: " << stLevel_.CESLevel;
732 }
733 EXPECT_TRUE(result);
734 }
735
736 /*
737 * @tc.number: CES_MatchingSkills_MatchEntity_0300
738 * @tc.name: MatchEntity and AddEntity
739 * @tc.desc: Verify the function of MatchingSkills entity : MatchEntity、AddEntity
740 */
741 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchEntity_0300, Function | MediumTest | Level1)
742 {
743 bool result = false;
744 MatchingSkills matchingSkills;
745 std::vector<std::string> entityVector;
746 std::string entity = "matchEntity3";
747 for (int i = 1; i <= stLevel_.CESLevel; i++) {
748 EXPECT_TRUE(matchingSkills.MatchEntity(entityVector));
749 matchingSkills.AddEntity(entity);
750 entityVector.emplace_back(entity);
751 EXPECT_TRUE(matchingSkills.MatchEntity(entityVector));
752
753 entityVector.emplace_back("entityTestMatchEntity3");
754 if (matchingSkills.MatchEntity(entityVector)) {
755 result = false;
756 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEntity_0300 failed, frequency: " << i;
757 break;
758 } else {
759 result = true;
760 }
761 matchingSkills.RemoveEntity(entity);
762 entityVector.clear();
763 }
764 if (result && stLevel_.CESLevel >= 1) {
765 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEntity_0300 stress level: " << stLevel_.CESLevel;
766 }
767 EXPECT_TRUE(result);
768 }
769
770 /*
771 * @tc.number: CES_MatchingSkills_MatchEntity_0400
772 * @tc.name: MatchEntity and AddEntity
773 * @tc.desc: Verify the function of MatchingSkills entity : MatchEntity、AddEntity
774 */
775 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchEntity_0400, Function | MediumTest | Level1)
776 {
777 bool result = false;
778 MatchingSkills matchingSkills;
779 std::vector<std::string> entityVector;
780 std::string entity = "matchEntity4";
781 for (int i = 1; i <= stLevel_.CESLevel; i++) {
782 EXPECT_TRUE(matchingSkills.MatchEntity(entityVector));
783 matchingSkills.AddEntity(entity);
784 entityVector.emplace_back(entity);
785 EXPECT_TRUE(matchingSkills.MatchEntity(entityVector));
786
787 entityVector.emplace_back("entityTestMatchEntity4");
788 if (matchingSkills.MatchEntity(entityVector)) {
789 result = false;
790 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEntity_0400 failed, frequency: " << i;
791 break;
792 } else {
793 result = true;
794 }
795 matchingSkills.RemoveEntity(entity);
796 entityVector.clear();
797 }
798 if (result && stLevel_.CESLevel >= 1) {
799 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEntity_0400 stress level: " << stLevel_.CESLevel;
800 }
801 EXPECT_TRUE(result);
802 }
803
804 /*
805 * @tc.number: CES_MatchingSkills_MatchEntity_0500
806 * @tc.name: MatchEntity and AddEntity
807 * @tc.desc: Verify the function of MatchingSkills entity : MatchEntity、AddEntity
808 */
809 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchEntity_0500, Function | MediumTest | Level1)
810 {
811 bool result = false;
812 MatchingSkills matchingSkills;
813 std::vector<std::string> entityVector;
814 std::string entity = "matchEntity5";
815 for (int i = 1; i <= stLevel_.CESLevel; i++) {
816 EXPECT_TRUE(matchingSkills.MatchEntity(entityVector));
817 matchingSkills.AddEntity(entity);
818 entityVector.emplace_back(entity);
819 EXPECT_TRUE(matchingSkills.MatchEntity(entityVector));
820
821 entityVector.emplace_back("entityTestMatchEntity5");
822 if (matchingSkills.MatchEntity(entityVector)) {
823 result = false;
824 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEntity_0500 failed, frequency: " << i;
825 break;
826 } else {
827 result = true;
828 }
829 matchingSkills.RemoveEntity(entity);
830 entityVector.clear();
831 }
832 if (result && stLevel_.CESLevel >= 1) {
833 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchEntity_0500 stress level: " << stLevel_.CESLevel;
834 }
835 EXPECT_TRUE(result);
836 }
837
838 /*
839 * @tc.number: CES_MatchingSkills_MatchScheme_0100
840 * @tc.name: MatchScheme and AddScheme
841 * @tc.desc: Verify the function of MatchingSkills scheme : MatchScheme、AddScheme
842 */
843 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchScheme_0100, Function | MediumTest | Level1)
844 {
845 bool result = false;
846 MatchingSkills matchingSkills;
847 std::string scheme = "schemeMatchSchemeTest";
848 for (int i = 1; i <= stLevel_.CESLevel; i++) {
849 EXPECT_TRUE(matchingSkills.MatchScheme(""));
850 matchingSkills.AddScheme(scheme);
851 EXPECT_TRUE(matchingSkills.MatchScheme(scheme));
852
853 if (matchingSkills.MatchScheme("schemeMatchScheme")) {
854 result = false;
855 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchScheme_0100 failed, frequency: " << i;
856 break;
857 } else {
858 result = true;
859 }
860 matchingSkills.RemoveScheme(scheme);
861 }
862 if (result && stLevel_.CESLevel >= 1) {
863 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchScheme_0100 stress level: " << stLevel_.CESLevel;
864 }
865 EXPECT_TRUE(result);
866 }
867
868 /*
869 * @tc.number: CES_MatchingSkills_MatchScheme_0200
870 * @tc.name: check MatchScheme of MatchingSkills
871 * @tc.desc: verify the function of MatchingSkills: MatchScheme
872 */
873 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchScheme_0200, Function | MediumTest | Level1)
874 {
875 bool result = false;
876 MatchingSkills matchingSkills;
877 std::string scheme = "schemeMatchScheme";
878 for (int i = 1; i <= stLevel_.CESLevel; i++) {
879 EXPECT_TRUE(matchingSkills.MatchScheme(""));
880 matchingSkills.AddScheme(scheme);
881 EXPECT_TRUE(matchingSkills.MatchScheme(scheme));
882
883 if (!matchingSkills.MatchScheme("schemeMatchScheme")) {
884 result = false;
885 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchScheme_0200 failed, frequency: " << i;
886 break;
887 } else {
888 result = true;
889 }
890 matchingSkills.RemoveScheme(scheme);
891 }
892 if (result && stLevel_.CESLevel >= 1) {
893 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchScheme_0200 stress level: " << stLevel_.CESLevel;
894 }
895 EXPECT_TRUE(result);
896 }
897
898 /*
899 * @tc.number: CES_MatchingSkills_MatchScheme_0300
900 * @tc.name: MatchScheme
901 * @tc.desc: verify the function of MatchingSkills: MatchScheme
902 */
903 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchScheme_0300, Function | MediumTest | Level1)
904 {
905 bool result = false;
906 MatchingSkills matchingSkills;
907 std::string scheme = "MatchScheme";
908 for (int i = 1; i <= stLevel_.CESLevel; i++) {
909 matchingSkills.AddScheme(scheme);
910 EXPECT_TRUE(matchingSkills.MatchScheme(scheme));
911
912 if (!matchingSkills.MatchScheme("MatchScheme")) {
913 result = false;
914 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchScheme_0300 failed, frequency: " << i;
915 break;
916 } else {
917 result = true;
918 }
919 matchingSkills.RemoveScheme(scheme);
920 }
921 if (result && stLevel_.CESLevel >= 1) {
922 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchScheme_0300 stress level: " << stLevel_.CESLevel;
923 }
924 EXPECT_TRUE(result);
925 }
926
927 /*
928 * @tc.number: CES_MatchingSkills_MatchScheme_0400
929 * @tc.name: MatchScheme
930 * @tc.desc: verify the function of MatchingSkills: MatchScheme
931 */
932 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchScheme_0400, Function | MediumTest | Level1)
933 {
934 bool result = false;
935 MatchingSkills matchingSkills;
936 std::string scheme = "MatchScheme2";
937 for (int i = 1; i <= stLevel_.CESLevel; i++) {
938 matchingSkills.AddScheme(scheme);
939 EXPECT_TRUE(matchingSkills.MatchScheme(scheme));
940
941 if (!matchingSkills.MatchScheme("MatchScheme2")) {
942 result = false;
943 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchScheme_0400 failed, frequency: " << i;
944 break;
945 } else {
946 result = true;
947 }
948 matchingSkills.RemoveScheme(scheme);
949 }
950 if (result && stLevel_.CESLevel >= 1) {
951 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchScheme_0400 stress level: " << stLevel_.CESLevel;
952 }
953 EXPECT_TRUE(result);
954 }
955
956 /*
957 * @tc.number: CES_MatchingSkills_MatchScheme_0500
958 * @tc.name: MatchScheme
959 * @tc.desc: verify the function of MatchingSkills: MatchScheme
960 */
961 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_MatchScheme_0500, Function | MediumTest | Level1)
962 {
963 bool result = false;
964 MatchingSkills matchingSkills;
965 std::string scheme = "MatchScheme5";
966 for (int i = 1; i <= stLevel_.CESLevel; i++) {
967 matchingSkills.AddScheme(scheme);
968 EXPECT_TRUE(matchingSkills.MatchScheme(scheme));
969
970 if (!matchingSkills.MatchScheme("MatchScheme5")) {
971 result = false;
972 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchScheme_0500 failed, frequency: " << i;
973 break;
974 } else {
975 result = true;
976 }
977 matchingSkills.RemoveScheme(scheme);
978 }
979 if (result && stLevel_.CESLevel >= 1) {
980 GTEST_LOG_(INFO) << "CES_MatchingSkills_MatchScheme_0500 stress level: " << stLevel_.CESLevel;
981 }
982 EXPECT_TRUE(result);
983 }
984
985 /*
986 * @tc.number: CES_MatchingSkills_Match_0100
987 * @tc.name: Match
988 * @tc.desc: verify the function of MatchingSkills: March Want
989 */
990 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Match_0100, Function | MediumTest | Level1)
991 {
992 bool result = false;
993 std::string eventName = "matchTest";
994 MatchingSkills matchingSkills;
995 Want want;
996 for (int i = 1; i <= stLevel_.CESLevel; i++) {
997 matchingSkills.AddEvent(eventName);
998 std::string entity = "entity";
999 matchingSkills.AddEntity(entity);
1000 want.AddEntity(entity);
1001 want.SetAction(eventName);
1002
1003 if (!matchingSkills.Match(want)) {
1004 result = false;
1005 GTEST_LOG_(INFO) << "CES_MatchingSkills_Match_0100 failed, frequency: " << i;
1006 break;
1007 } else {
1008 result = true;
1009 }
1010 matchingSkills.RemoveEvent(eventName);
1011 matchingSkills.RemoveEntity(entity);
1012 want.RemoveEntity(entity);
1013 }
1014 if (result && stLevel_.CESLevel >= 1) {
1015 GTEST_LOG_(INFO) << "CES_MatchingSkills_Match_0100 stress level: " << stLevel_.CESLevel;
1016 }
1017 EXPECT_TRUE(result);
1018 }
1019
1020 /*
1021 * @tc.number: CES_MatchingSkills_Match_0200
1022 * @tc.name: Match
1023 * @tc.desc: verify the function of MatchingSkills: March Want
1024 */
1025 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Match_0200, Function | MediumTest | Level1)
1026 {
1027 bool result = false;
1028 std::string eventName2 = "matchTest2";
1029 MatchingSkills matchingSkills;
1030 Want want;
1031 for (int i = 1; i <= stLevel_.CESLevel; i++) {
1032 matchingSkills.AddEvent(eventName2);
1033 std::string entity = "entity2";
1034 matchingSkills.AddEntity(entity);
1035
1036 want.AddEntity(entity);
1037 want.SetAction(eventName2);
1038 if (!matchingSkills.Match(want)) {
1039 result = false;
1040 GTEST_LOG_(INFO) << "CES_MatchingSkills_Match_0200 failed, frequency: " << i;
1041 break;
1042 } else {
1043 result = true;
1044 }
1045 matchingSkills.RemoveEvent(eventName2);
1046 matchingSkills.RemoveEntity(entity);
1047 want.RemoveEntity(entity);
1048 }
1049 if (result && stLevel_.CESLevel >= 1) {
1050 GTEST_LOG_(INFO) << "CES_MatchingSkills_Match_0200 stress level: " << stLevel_.CESLevel;
1051 }
1052 EXPECT_TRUE(result);
1053 }
1054
1055 /*
1056 * @tc.number: CES_MatchingSkills_Match_0300
1057 * @tc.name: Match
1058 * @tc.desc: verify the function of MatchingSkills: March Want
1059 */
1060 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Match_0300, Function | MediumTest | Level1)
1061 {
1062 bool result = false;
1063 std::string eventName3 = "matchTest3";
1064 MatchingSkills matchingSkills;
1065 Want want;
1066 for (int i = 1; i <= stLevel_.CESLevel; i++) {
1067 matchingSkills.AddEvent(eventName3);
1068 std::string entity = "entity3";
1069 matchingSkills.AddEntity(entity);
1070 want.AddEntity(entity);
1071 want.SetAction(eventName3);
1072 if (!matchingSkills.Match(want)) {
1073 result = false;
1074 GTEST_LOG_(INFO) << "CES_MatchingSkills_Match_0300 failed, frequency: " << i;
1075 break;
1076 } else {
1077 result = true;
1078 }
1079 matchingSkills.RemoveEvent(eventName3);
1080 matchingSkills.RemoveEntity(entity);
1081 want.RemoveEntity(entity);
1082 }
1083 if (result && stLevel_.CESLevel >= 1) {
1084 GTEST_LOG_(INFO) << "CES_MatchingSkills_Match_0300 stress level: " << stLevel_.CESLevel;
1085 }
1086 EXPECT_TRUE(result);
1087 }
1088
1089 /*
1090 * @tc.number: CES_MatchingSkills_Match_0400
1091 * @tc.name: Match
1092 * @tc.desc: verify the function of MatchingSkills: March Want
1093 */
1094 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Match_0400, Function | MediumTest | Level1)
1095 {
1096 bool result = false;
1097 std::string eventName4 = "matchTest4";
1098 MatchingSkills matchingSkills;
1099 Want want;
1100 for (int i = 1; i <= stLevel_.CESLevel; i++) {
1101 matchingSkills.AddEvent(eventName4);
1102 std::string entity = "entity4";
1103 matchingSkills.AddEntity(entity);
1104 want.AddEntity(entity);
1105 want.SetAction(eventName4);
1106 if (!matchingSkills.Match(want)) {
1107 result = false;
1108 GTEST_LOG_(INFO) << "CES_MatchingSkills_Match_0400 failed, frequency: " << i;
1109 break;
1110 } else {
1111 result = true;
1112 }
1113 matchingSkills.RemoveEvent(eventName4);
1114 matchingSkills.RemoveEntity(entity);
1115 want.RemoveEntity(entity);
1116 }
1117 if (result && stLevel_.CESLevel >= 1) {
1118 GTEST_LOG_(INFO) << "CES_MatchingSkills_Match_0400 stress level: " << stLevel_.CESLevel;
1119 }
1120 EXPECT_TRUE(result);
1121 }
1122
1123 /*
1124 * @tc.number: CES_MatchingSkills_Match_0500
1125 * @tc.name: Match
1126 * @tc.desc: verify the function of MatchingSkills: March Want
1127 */
1128 HWTEST_F(ActsCESMatchingSkillsTest, CES_MatchingSkills_Match_0500, Function | MediumTest | Level1)
1129 {
1130 bool result = false;
1131 std::string eventName5 = "matchTest5";
1132 MatchingSkills matchingSkills;
1133 Want want;
1134 for (int i = 1; i <= stLevel_.CESLevel; i++) {
1135 matchingSkills.AddEvent(eventName5);
1136 std::string entity = "entity5";
1137 matchingSkills.AddEntity(entity);
1138 want.AddEntity(entity);
1139 want.SetAction(eventName5);
1140 if (!matchingSkills.Match(want)) {
1141 result = false;
1142 GTEST_LOG_(INFO) << "CES_MatchingSkills_Match_0500 failed, frequency: " << i;
1143 break;
1144 } else {
1145 result = true;
1146 }
1147 matchingSkills.RemoveEvent(eventName5);
1148 matchingSkills.RemoveEntity(entity);
1149 want.RemoveEntity(entity);
1150 }
1151 if (result && stLevel_.CESLevel >= 1) {
1152 GTEST_LOG_(INFO) << "CES_MatchingSkills_Match_0500 stress level: " << stLevel_.CESLevel;
1153 }
1154 EXPECT_TRUE(result);
1155 }
1156 } // namespace EventFwk
1157 } // namespace OHOS