AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
SpellProcDataDrivenTest.cpp File Reference

Comprehensive data-driven tests for ALL 869 spell_proc entries. More...

#include "ProcEventInfoHelper.h"
#include "SpellInfoTestHelper.h"
#include "SpellMgr.h"
#include "SpellProcTestData.h"
#include "WorldMock.h"
#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include <map>
#include <set>

Go to the source code of this file.

Classes

struct  ProcFlagScenario
 
class  SpellProcDatabaseTest
 

Functions

 TEST_F (SpellProcDatabaseTest, AllEntriesLoaded)
 
 TEST_F (SpellProcDatabaseTest, AllEntriesWithProcFlags_PositiveTest)
 
 TEST_F (SpellProcDatabaseTest, AllEntriesWithProcFlags_NegativeTest)
 
 TEST_F (SpellProcDatabaseTest, MeleeProcs_AllTriggerOnMelee)
 
 TEST_F (SpellProcDatabaseTest, SpellDamageProcs_AllTriggerOnSpellDamage)
 
 TEST_F (SpellProcDatabaseTest, HealProcs_AllTriggerOnHeal)
 
 TEST_F (SpellProcDatabaseTest, PeriodicProcs_AllTriggerOnPeriodic)
 
 TEST_F (SpellProcDatabaseTest, KillProcs_AllTriggerOnKill)
 
 TEST_F (SpellProcDatabaseTest, CritOnlyProcs_OnlyTriggerOnCrit)
 
 TEST_F (SpellProcDatabaseTest, DodgeProcs_OnlyTriggerOnDodge)
 
 TEST_F (SpellProcDatabaseTest, ParryProcs_OnlyTriggerOnParry)
 
 TEST_F (SpellProcDatabaseTest, BlockProcs_OnlyTriggerOnBlock)
 
 TEST_F (SpellProcDatabaseTest, GroupBySpellFamily_Statistics)
 
 TEST_F (SpellProcDatabaseTest, GroupByProcFlags_Statistics)
 
 TEST_F (SpellProcDatabaseTest, GroupByHitMask_Statistics)
 
 TEST_F (SpellProcDatabaseTest, ToSpellProcEntry_ConversionCorrect)
 

Variables

static const std::vector< ProcFlagScenario > PROC_FLAG_SCENARIOS
 
static const std::vector< std::pair< uint32, char const * > > HIT_MASK_SCENARIOS
 

Detailed Description

Comprehensive data-driven tests for ALL 869 spell_proc entries.

This file auto-tests every spell_proc entry from the database. Data is generated by: src/test/scripts/generate_spell_proc_data.py

Definition in file SpellProcDataDrivenTest.cpp.

Function Documentation

◆ TEST_F() [1/16]

TEST_F ( SpellProcDatabaseTest  ,
AllEntriesLoaded   
)
259{
260 EXPECT_EQ(_allEntries.size(), 869u) << "Should have all 869 spell_proc entries loaded";
261}

◆ TEST_F() [2/16]

TEST_F ( SpellProcDatabaseTest  ,
AllEntriesWithProcFlags_NegativeTest   
)
319{
320 int totalTested = 0;
321 int correctlyRejected = 0;
322
323 for (auto const& entry : _allEntries)
324 {
325 if (entry.ProcFlags == 0)
326 continue;
327 if (RequiresSpellFamilyMatch(entry))
328 continue;
329
330 // Find a flag that's NOT in this entry's ProcFlags
331 uint32 wrongFlag = 0;
332 for (auto const& scenario : PROC_FLAG_SCENARIOS)
333 {
334 if (!(entry.ProcFlags & scenario.procFlag) && scenario.procFlag != PROC_FLAG_KILL)
335 {
336 wrongFlag = scenario.procFlag;
337 break;
338 }
339 }
340
341 if (wrongFlag == 0)
342 continue;
343
344 totalTested++;
345
346 SpellProcEntry procEntry = entry.ToSpellProcEntry();
347
348 auto eventInfo = ProcEventInfoBuilder()
349 .WithTypeMask(wrongFlag)
351 .Build();
352
353 if (!sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo))
354 {
355 correctlyRejected++;
356 }
357 }
358
359 float rejectRate = totalTested > 0 ? (float)correctlyRejected / totalTested * 100 : 0;
360 SCOPED_TRACE("Tested: " + std::to_string(totalTested));
361 SCOPED_TRACE("Rejected: " + std::to_string(correctlyRejected) + " (" + std::to_string((int)rejectRate) + "%)");
362
363 EXPECT_GT(rejectRate, 90.0f) << "Most entries should reject non-matching proc flags";
364}
std::uint32_t uint32
Definition Define.h:107
@ PROC_HIT_NORMAL
Definition SpellMgr.h:257
#define sSpellMgr
Definition SpellMgr.h:847
@ PROC_FLAG_KILL
Definition SpellMgr.h:111
static const std::vector< ProcFlagScenario > PROC_FLAG_SCENARIOS
Definition SpellProcDataDrivenTest.cpp:52
Builder class for creating ProcEventInfo test instances.
Definition ProcEventInfoHelper.h:31
ProcEventInfoBuilder & WithTypeMask(uint32 typeMask)
Definition ProcEventInfoHelper.h:57
ProcEventInfoBuilder & WithHitMask(uint32 hitMask)
Definition ProcEventInfoHelper.h:75
ProcEventInfo Build()
Definition ProcEventInfoHelper.h:111
Definition SpellMgr.h:286

References ProcEventInfoBuilder::Build(), PROC_FLAG_KILL, PROC_FLAG_SCENARIOS, PROC_HIT_NORMAL, sSpellMgr, ProcEventInfoBuilder::WithHitMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [3/16]

TEST_F ( SpellProcDatabaseTest  ,
AllEntriesWithProcFlags_PositiveTest   
)
264{
265 int totalTested = 0;
266 int passed = 0;
267 int skippedFamily = 0;
268 int skippedNoFlags = 0;
269
270 for (auto const& entry : _allEntries)
271 {
272 // Skip entries with no ProcFlags (they rely on other conditions)
273 if (entry.ProcFlags == 0)
274 {
275 skippedNoFlags++;
276 continue;
277 }
278
279 // Skip entries that require SpellFamily matching
280 if (RequiresSpellFamilyMatch(entry))
281 {
282 skippedFamily++;
283 continue;
284 }
285
286 totalTested++;
287
288 ProcFlagScenario const* scenario = FindMatchingScenario(entry.ProcFlags);
289 if (!scenario)
290 continue;
291
292 SpellProcEntry procEntry = entry.ToSpellProcEntry();
293
294 auto eventInfo = CreateEventInfo(
295 scenario->procFlag,
296 GetEffectiveHitMask(entry, scenario),
297 GetEffectiveSpellTypeMask(entry, scenario),
298 GetEffectiveSpellPhaseMask(entry, scenario));
299
300 if (sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo))
301 {
302 passed++;
303 }
304 }
305
306 // Report statistics
307 float passRate = totalTested > 0 ? (float)passed / totalTested * 100 : 0;
308 SCOPED_TRACE("Total entries: " + std::to_string(_allEntries.size()));
309 SCOPED_TRACE("Tested: " + std::to_string(totalTested));
310 SCOPED_TRACE("Passed: " + std::to_string(passed) + " (" + std::to_string((int)passRate) + "%)");
311 SCOPED_TRACE("Skipped (SpellFamily): " + std::to_string(skippedFamily));
312 SCOPED_TRACE("Skipped (NoFlags): " + std::to_string(skippedNoFlags));
313
314 // Expect high pass rate for entries we can test
315 EXPECT_GT(passed, totalTested / 2) << "At least half of tested entries should pass";
316}
Definition SpellProcDataDrivenTest.cpp:43
uint32 procFlag
Definition SpellProcDataDrivenTest.cpp:44

References ProcFlagScenario::procFlag, and sSpellMgr.

◆ TEST_F() [4/16]

TEST_F ( SpellProcDatabaseTest  ,
BlockProcs_OnlyTriggerOnBlock   
)
662{
663 int tested = 0, passed = 0;
664
665 for (auto const& entry : _allEntries)
666 {
667 if (!(entry.HitMask & PROC_HIT_BLOCK))
668 continue;
669 if (entry.ProcFlags == 0)
670 continue;
671
672 ProcFlagScenario const* scenario = FindMatchingScenario(entry.ProcFlags);
673 if (!scenario)
674 continue;
675
676 tested++;
677 SpellProcEntry procEntry = entry.ToSpellProcEntry();
678
679 auto eventInfo = CreateEventInfo(
680 scenario->procFlag,
682 GetEffectiveSpellTypeMask(entry, scenario),
683 GetEffectiveSpellPhaseMask(entry, scenario));
684
685 if (sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo))
686 passed++;
687 }
688
689 SCOPED_TRACE("Block procs: " + std::to_string(tested) + " tested, " + std::to_string(passed) + " passed");
690 if (tested > 0)
691 {
692 EXPECT_EQ(passed, tested);
693 }
694}
@ PROC_HIT_BLOCK
Definition SpellMgr.h:263

References PROC_HIT_BLOCK, ProcFlagScenario::procFlag, and sSpellMgr.

◆ TEST_F() [5/16]

TEST_F ( SpellProcDatabaseTest  ,
CritOnlyProcs_OnlyTriggerOnCrit   
)
538{
539 int tested = 0, critPassed = 0, normalRejected = 0;
540
541 for (auto const& entry : _allEntries)
542 {
543 // Only entries with EXACTLY crit requirement
544 if (entry.HitMask != PROC_HIT_CRITICAL)
545 continue;
546 if (entry.ProcFlags == 0)
547 continue;
548 if (RequiresSpellFamilyMatch(entry))
549 continue;
550
551 ProcFlagScenario const* scenario = FindMatchingScenario(entry.ProcFlags);
552 if (!scenario)
553 continue;
554
555 tested++;
556 SpellProcEntry procEntry = entry.ToSpellProcEntry();
557
558 // Test crit - should pass
559 auto critEvent = CreateEventInfo(
560 scenario->procFlag,
562 GetEffectiveSpellTypeMask(entry, scenario),
563 GetEffectiveSpellPhaseMask(entry, scenario));
564
565 if (sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, critEvent))
566 critPassed++;
567
568 // Test normal - should fail
569 auto normalEvent = CreateEventInfo(
570 scenario->procFlag,
572 GetEffectiveSpellTypeMask(entry, scenario),
573 GetEffectiveSpellPhaseMask(entry, scenario));
574
575 if (!sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, normalEvent))
576 normalRejected++;
577 }
578
579 SCOPED_TRACE("Crit-only procs: " + std::to_string(tested) + " tested");
580 SCOPED_TRACE("Crit passed: " + std::to_string(critPassed));
581 SCOPED_TRACE("Normal rejected: " + std::to_string(normalRejected));
582
583 if (tested > 0)
584 {
585 // Most crit-only entries should work, but some may have additional requirements
586 EXPECT_GT(critPassed, 0) << "At least some crit-only procs should trigger on crits";
587 EXPECT_GT(normalRejected, 0) << "At least some crit-only procs should NOT trigger on normal hits";
588 }
589}
@ PROC_HIT_CRITICAL
Definition SpellMgr.h:258

References PROC_HIT_CRITICAL, PROC_HIT_NORMAL, ProcFlagScenario::procFlag, and sSpellMgr.

◆ TEST_F() [6/16]

TEST_F ( SpellProcDatabaseTest  ,
DodgeProcs_OnlyTriggerOnDodge   
)
592{
593 int tested = 0, passed = 0;
594
595 for (auto const& entry : _allEntries)
596 {
597 if (!(entry.HitMask & PROC_HIT_DODGE))
598 continue;
599 if (entry.ProcFlags == 0)
600 continue;
601
602 ProcFlagScenario const* scenario = FindMatchingScenario(entry.ProcFlags);
603 if (!scenario)
604 continue;
605
606 tested++;
607 SpellProcEntry procEntry = entry.ToSpellProcEntry();
608
609 auto eventInfo = CreateEventInfo(
610 scenario->procFlag,
612 GetEffectiveSpellTypeMask(entry, scenario),
613 GetEffectiveSpellPhaseMask(entry, scenario));
614
615 if (sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo))
616 passed++;
617 }
618
619 SCOPED_TRACE("Dodge procs: " + std::to_string(tested) + " tested, " + std::to_string(passed) + " passed");
620 if (tested > 0)
621 {
622 EXPECT_EQ(passed, tested);
623 }
624}
@ PROC_HIT_DODGE
Definition SpellMgr.h:261

References PROC_HIT_DODGE, ProcFlagScenario::procFlag, and sSpellMgr.

◆ TEST_F() [7/16]

TEST_F ( SpellProcDatabaseTest  ,
GroupByHitMask_Statistics   
)
736{
737 std::map<uint32, int> hitCounts;
738 for (auto const& entry : _allEntries)
739 {
740 hitCounts[entry.HitMask]++;
741 }
742
743 SCOPED_TRACE("Unique HitMask patterns: " + std::to_string(hitCounts.size()));
744 EXPECT_GT(hitCounts.size(), 0u);
745}

◆ TEST_F() [8/16]

TEST_F ( SpellProcDatabaseTest  ,
GroupByProcFlags_Statistics   
)
724{
725 std::map<uint32, int> flagCounts;
726 for (auto const& entry : _allEntries)
727 {
728 flagCounts[entry.ProcFlags]++;
729 }
730
731 SCOPED_TRACE("Unique ProcFlags patterns: " + std::to_string(flagCounts.size()));
732 EXPECT_GT(flagCounts.size(), 0u);
733}

◆ TEST_F() [9/16]

TEST_F ( SpellProcDatabaseTest  ,
GroupBySpellFamily_Statistics   
)
701{
702 std::map<uint32, std::string> familyNames = {
703 {0, "Generic"}, {3, "Mage"}, {4, "Warrior"}, {5, "Warlock"},
704 {6, "Priest"}, {7, "Druid"}, {8, "Rogue"}, {9, "Hunter"},
705 {10, "Paladin"}, {11, "Shaman"}, {15, "DeathKnight"}
706 };
707
708 std::map<uint32, int> familyCounts;
709 for (auto const& entry : _allEntries)
710 {
711 familyCounts[entry.SpellFamilyName]++;
712 }
713
714 for (auto const& [family, count] : familyCounts)
715 {
716 std::string name = familyNames.count(family) ? familyNames[family] : "Unknown(" + std::to_string(family) + ")";
717 SCOPED_TRACE("SpellFamily " + name + ": " + std::to_string(count) + " entries");
718 }
719
720 EXPECT_GT(familyCounts.size(), 0u);
721}

◆ TEST_F() [10/16]

TEST_F ( SpellProcDatabaseTest  ,
HealProcs_AllTriggerOnHeal   
)
438{
439 int tested = 0, passed = 0;
440
441 for (auto const& entry : _allEntries)
442 {
443 if (!(entry.ProcFlags & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS))
444 continue;
445 if (RequiresSpellFamilyMatch(entry))
446 continue;
447
448 tested++;
449 SpellProcEntry procEntry = entry.ToSpellProcEntry();
450
451 uint32 hitMask = entry.HitMask != 0 ? (entry.HitMask & -entry.HitMask) : static_cast<uint32>(PROC_HIT_NORMAL);
452 uint32 spellTypeMask = entry.SpellTypeMask != 0 ? entry.SpellTypeMask : static_cast<uint32>(PROC_SPELL_TYPE_HEAL);
453 uint32 spellPhaseMask = entry.SpellPhaseMask != 0 ? entry.SpellPhaseMask : static_cast<uint32>(PROC_SPELL_PHASE_HIT);
454
455 auto eventInfo = CreateEventInfo(
457 hitMask,
459 spellPhaseMask);
460
461 if (sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo))
462 passed++;
463 }
464
465 SCOPED_TRACE("Heal procs: " + std::to_string(tested) + " tested, " + std::to_string(passed) + " passed");
466 if (tested > 0)
467 {
468 EXPECT_GT(passed, 0);
469 }
470}
static uint32 spellTypeMask[TOTAL_AURAS]
Definition SpellMgr.cpp:1938
@ PROC_SPELL_TYPE_HEAL
Definition SpellMgr.h:240
@ PROC_SPELL_PHASE_HIT
Definition SpellMgr.h:249
@ PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS
Definition SpellMgr.h:131
uint32 HitMask
Definition SpellMgr.h:293

References SpellProcEntry::HitMask, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_HIT_NORMAL, PROC_SPELL_PHASE_HIT, PROC_SPELL_TYPE_HEAL, spellTypeMask, and sSpellMgr.

◆ TEST_F() [11/16]

TEST_F ( SpellProcDatabaseTest  ,
KillProcs_AllTriggerOnKill   
)
508{
509 int tested = 0, passed = 0;
510
511 for (auto const& entry : _allEntries)
512 {
513 if (!(entry.ProcFlags & PROC_FLAG_KILL))
514 continue;
515
516 tested++;
517 SpellProcEntry procEntry = entry.ToSpellProcEntry();
518
519 auto eventInfo = ProcEventInfoBuilder()
522 .Build();
523
524 if (sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo))
525 passed++;
526 }
527
528 SCOPED_TRACE("Kill procs: " + std::to_string(tested) + " tested, " + std::to_string(passed) + " passed");
529 // Kill events always proc
530 EXPECT_EQ(passed, tested);
531}

References ProcEventInfoBuilder::Build(), PROC_FLAG_KILL, PROC_HIT_NORMAL, sSpellMgr, ProcEventInfoBuilder::WithHitMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [12/16]

TEST_F ( SpellProcDatabaseTest  ,
MeleeProcs_AllTriggerOnMelee   
)
371{
372 int tested = 0, passed = 0;
373
374 for (auto const& entry : _allEntries)
375 {
376 if (!(entry.ProcFlags & PROC_FLAG_DONE_MELEE_AUTO_ATTACK))
377 continue;
378 if (RequiresSpellFamilyMatch(entry))
379 continue;
380
381 tested++;
382 SpellProcEntry procEntry = entry.ToSpellProcEntry();
383
384 uint32 hitMask = entry.HitMask != 0 ? (entry.HitMask & -entry.HitMask) : static_cast<uint32>(PROC_HIT_NORMAL);
385
386 auto eventInfo = ProcEventInfoBuilder()
388 .WithHitMask(hitMask)
389 .Build();
390
391 if (sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo))
392 passed++;
393 }
394
395 SCOPED_TRACE("Melee procs: " + std::to_string(tested) + " tested, " + std::to_string(passed) + " passed");
396 if (tested > 0)
397 {
398 EXPECT_EQ(passed, tested);
399 }
400}
@ PROC_FLAG_DONE_MELEE_AUTO_ATTACK
Definition SpellMgr.h:113

References ProcEventInfoBuilder::Build(), SpellProcEntry::HitMask, PROC_FLAG_DONE_MELEE_AUTO_ATTACK, PROC_HIT_NORMAL, sSpellMgr, ProcEventInfoBuilder::WithHitMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TEST_F() [13/16]

TEST_F ( SpellProcDatabaseTest  ,
ParryProcs_OnlyTriggerOnParry   
)
627{
628 int tested = 0, passed = 0;
629
630 for (auto const& entry : _allEntries)
631 {
632 if (!(entry.HitMask & PROC_HIT_PARRY))
633 continue;
634 if (entry.ProcFlags == 0)
635 continue;
636
637 ProcFlagScenario const* scenario = FindMatchingScenario(entry.ProcFlags);
638 if (!scenario)
639 continue;
640
641 tested++;
642 SpellProcEntry procEntry = entry.ToSpellProcEntry();
643
644 auto eventInfo = CreateEventInfo(
645 scenario->procFlag,
647 GetEffectiveSpellTypeMask(entry, scenario),
648 GetEffectiveSpellPhaseMask(entry, scenario));
649
650 if (sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo))
651 passed++;
652 }
653
654 SCOPED_TRACE("Parry procs: " + std::to_string(tested) + " tested, " + std::to_string(passed) + " passed");
655 if (tested > 0)
656 {
657 EXPECT_EQ(passed, tested);
658 }
659}
@ PROC_HIT_PARRY
Definition SpellMgr.h:262

References PROC_HIT_PARRY, ProcFlagScenario::procFlag, and sSpellMgr.

◆ TEST_F() [14/16]

TEST_F ( SpellProcDatabaseTest  ,
PeriodicProcs_AllTriggerOnPeriodic   
)
473{
474 int tested = 0, passed = 0;
475
476 for (auto const& entry : _allEntries)
477 {
478 if (!(entry.ProcFlags & PROC_FLAG_DONE_PERIODIC))
479 continue;
480 if (RequiresSpellFamilyMatch(entry))
481 continue;
482
483 tested++;
484 SpellProcEntry procEntry = entry.ToSpellProcEntry();
485
486 uint32 hitMask = entry.HitMask != 0 ? (entry.HitMask & -entry.HitMask) : static_cast<uint32>(PROC_HIT_NORMAL);
487 uint32 spellTypeMask = entry.SpellTypeMask != 0 ? entry.SpellTypeMask : static_cast<uint32>(PROC_SPELL_TYPE_DAMAGE);
488 uint32 spellPhaseMask = entry.SpellPhaseMask != 0 ? entry.SpellPhaseMask : static_cast<uint32>(PROC_SPELL_PHASE_HIT);
489
490 auto eventInfo = CreateEventInfo(
492 hitMask,
494 spellPhaseMask);
495
496 if (sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo))
497 passed++;
498 }
499
500 SCOPED_TRACE("Periodic procs: " + std::to_string(tested) + " tested, " + std::to_string(passed) + " passed");
501 if (tested > 0)
502 {
503 EXPECT_GT(passed, 0);
504 }
505}
@ PROC_SPELL_TYPE_DAMAGE
Definition SpellMgr.h:239
@ PROC_FLAG_DONE_PERIODIC
Definition SpellMgr.h:137

References SpellProcEntry::HitMask, PROC_FLAG_DONE_PERIODIC, PROC_HIT_NORMAL, PROC_SPELL_PHASE_HIT, PROC_SPELL_TYPE_DAMAGE, spellTypeMask, and sSpellMgr.

◆ TEST_F() [15/16]

TEST_F ( SpellProcDatabaseTest  ,
SpellDamageProcs_AllTriggerOnSpellDamage   
)
403{
404 int tested = 0, passed = 0;
405
406 for (auto const& entry : _allEntries)
407 {
408 if (!(entry.ProcFlags & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG))
409 continue;
410 if (RequiresSpellFamilyMatch(entry))
411 continue;
412
413 tested++;
414 SpellProcEntry procEntry = entry.ToSpellProcEntry();
415
416 uint32 hitMask = entry.HitMask != 0 ? (entry.HitMask & -entry.HitMask) : static_cast<uint32>(PROC_HIT_NORMAL);
417 uint32 spellTypeMask = entry.SpellTypeMask != 0 ? entry.SpellTypeMask : static_cast<uint32>(PROC_SPELL_TYPE_DAMAGE);
418 uint32 spellPhaseMask = entry.SpellPhaseMask != 0 ? entry.SpellPhaseMask : static_cast<uint32>(PROC_SPELL_PHASE_HIT);
419
420 auto eventInfo = CreateEventInfo(
422 hitMask,
424 spellPhaseMask);
425
426 if (sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo))
427 passed++;
428 }
429
430 SCOPED_TRACE("Spell damage procs: " + std::to_string(tested) + " tested, " + std::to_string(passed) + " passed");
431 if (tested > 0)
432 {
433 EXPECT_GT(passed, 0);
434 }
435}
@ PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG
Definition SpellMgr.h:134

References SpellProcEntry::HitMask, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG, PROC_HIT_NORMAL, PROC_SPELL_PHASE_HIT, PROC_SPELL_TYPE_DAMAGE, spellTypeMask, and sSpellMgr.

◆ TEST_F() [16/16]

TEST_F ( SpellProcDatabaseTest  ,
ToSpellProcEntry_ConversionCorrect   
)
752{
753 for (auto const& entry : _allEntries)
754 {
755 SpellProcEntry converted = entry.ToSpellProcEntry();
756
757 EXPECT_EQ(converted.SchoolMask, entry.SchoolMask);
758 EXPECT_EQ(converted.SpellFamilyName, entry.SpellFamilyName);
759 EXPECT_EQ(converted.SpellFamilyMask[0], entry.SpellFamilyMask0);
760 EXPECT_EQ(converted.SpellFamilyMask[1], entry.SpellFamilyMask1);
761 EXPECT_EQ(converted.SpellFamilyMask[2], entry.SpellFamilyMask2);
762 EXPECT_EQ(converted.ProcFlags, entry.ProcFlags);
763 EXPECT_EQ(converted.SpellTypeMask, entry.SpellTypeMask);
764 EXPECT_EQ(converted.SpellPhaseMask, entry.SpellPhaseMask);
765 EXPECT_EQ(converted.HitMask, entry.HitMask);
766 EXPECT_EQ(converted.AttributesMask, entry.AttributesMask);
767 EXPECT_EQ(converted.Cooldown.count(), static_cast<int64>(entry.Cooldown));
768 EXPECT_FLOAT_EQ(converted.Chance, entry.Chance);
769 }
770}
std::int64_t int64
Definition Define.h:102
uint32 SpellFamilyName
Definition SpellMgr.h:288
Milliseconds Cooldown
Definition SpellMgr.h:298
uint32 AttributesMask
Definition SpellMgr.h:294
flag96 SpellFamilyMask
Definition SpellMgr.h:289
uint32 SpellTypeMask
Definition SpellMgr.h:291
uint32 ProcFlags
Definition SpellMgr.h:290
uint32 SpellPhaseMask
Definition SpellMgr.h:292
uint32 SchoolMask
Definition SpellMgr.h:287
float Chance
Definition SpellMgr.h:297

References SpellProcEntry::AttributesMask, SpellProcEntry::Chance, SpellProcEntry::Cooldown, SpellProcEntry::HitMask, SpellProcEntry::ProcFlags, SpellProcEntry::SchoolMask, SpellProcEntry::SpellFamilyMask, SpellProcEntry::SpellFamilyName, SpellProcEntry::SpellPhaseMask, and SpellProcEntry::SpellTypeMask.

Variable Documentation

◆ HIT_MASK_SCENARIOS

const std::vector<std::pair<uint32, char const*> > HIT_MASK_SCENARIOS
static
Initial value:
= {
{ PROC_HIT_NORMAL, "Normal" },
{ PROC_HIT_CRITICAL, "Critical" },
{ PROC_HIT_MISS, "Miss" },
{ PROC_HIT_DODGE, "Dodge" },
{ PROC_HIT_PARRY, "Parry" },
{ PROC_HIT_BLOCK, "Block" },
{ PROC_HIT_EVADE, "Evade" },
{ PROC_HIT_IMMUNE, "Immune" },
{ PROC_HIT_DEFLECT, "Deflect" },
{ PROC_HIT_ABSORB, "Absorb" },
{ PROC_HIT_REFLECT, "Reflect" },
{ PROC_HIT_INTERRUPT, "Interrupt" },
{ PROC_HIT_FULL_BLOCK, "FullBlock" },
}
@ PROC_HIT_FULL_BLOCK
Definition SpellMgr.h:270
@ PROC_HIT_MISS
Definition SpellMgr.h:259
@ PROC_HIT_INTERRUPT
Definition SpellMgr.h:269
@ PROC_HIT_DEFLECT
Definition SpellMgr.h:266
@ PROC_HIT_EVADE
Definition SpellMgr.h:264
@ PROC_HIT_IMMUNE
Definition SpellMgr.h:265
@ PROC_HIT_ABSORB
Definition SpellMgr.h:267
@ PROC_HIT_REFLECT
Definition SpellMgr.h:268
80 {
81 { PROC_HIT_NORMAL, "Normal" },
82 { PROC_HIT_CRITICAL, "Critical" },
83 { PROC_HIT_MISS, "Miss" },
84 { PROC_HIT_DODGE, "Dodge" },
85 { PROC_HIT_PARRY, "Parry" },
86 { PROC_HIT_BLOCK, "Block" },
87 { PROC_HIT_EVADE, "Evade" },
88 { PROC_HIT_IMMUNE, "Immune" },
89 { PROC_HIT_DEFLECT, "Deflect" },
90 { PROC_HIT_ABSORB, "Absorb" },
91 { PROC_HIT_REFLECT, "Reflect" },
92 { PROC_HIT_INTERRUPT, "Interrupt" },
93 { PROC_HIT_FULL_BLOCK, "FullBlock" },
94};

Referenced by SpellProcDatabaseTest::GetEffectiveHitMask().

◆ PROC_FLAG_SCENARIOS

const std::vector<ProcFlagScenario> PROC_FLAG_SCENARIOS
static
Initial value:
= {
{ PROC_FLAG_DONE_MELEE_AUTO_ATTACK, "DoneMeleeAuto", PROC_HIT_NORMAL, 0, 0, false },
{ PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK, "TakenMeleeAuto", PROC_HIT_NORMAL, 0, 0, false },
{ PROC_FLAG_DONE_MAINHAND_ATTACK, "DoneMainhand", PROC_HIT_NORMAL, 0, 0, false },
{ PROC_FLAG_DONE_OFFHAND_ATTACK, "DoneOffhand", PROC_HIT_NORMAL, 0, 0, false },
{ PROC_FLAG_TAKEN_DAMAGE, "TakenDamage", PROC_HIT_NORMAL, 0, 0, false },
{ PROC_FLAG_KILL, "Kill", 0, 0, 0, false },
{ PROC_FLAG_KILLED, "Killed", 0, 0, 0, false },
{ PROC_FLAG_DEATH, "Death", 0, 0, 0, false },
}
@ PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS
Definition SpellMgr.h:122
@ PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK
Definition SpellMgr.h:120
@ PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS
Definition SpellMgr.h:125
@ PROC_FLAG_KILLED
Definition SpellMgr.h:110
@ PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS
Definition SpellMgr.h:116
@ PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG
Definition SpellMgr.h:135
@ PROC_FLAG_DEATH
Definition SpellMgr.h:146
@ PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS
Definition SpellMgr.h:123
@ PROC_FLAG_TAKEN_PERIODIC
Definition SpellMgr.h:138
@ PROC_FLAG_DONE_MAINHAND_ATTACK
Definition SpellMgr.h:143
@ PROC_FLAG_DONE_RANGED_AUTO_ATTACK
Definition SpellMgr.h:119
@ PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG
Definition SpellMgr.h:129
@ PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG
Definition SpellMgr.h:128
@ PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS
Definition SpellMgr.h:132
@ PROC_FLAG_TAKEN_DAMAGE
Definition SpellMgr.h:140
@ PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK
Definition SpellMgr.h:114
@ PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS
Definition SpellMgr.h:126
@ PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS
Definition SpellMgr.h:117
@ PROC_FLAG_DONE_TRAP_ACTIVATION
Definition SpellMgr.h:141
@ PROC_FLAG_DONE_OFFHAND_ATTACK
Definition SpellMgr.h:144
52 {
53 { PROC_FLAG_DONE_MELEE_AUTO_ATTACK, "DoneMeleeAuto", PROC_HIT_NORMAL, 0, 0, false },
54 { PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK, "TakenMeleeAuto", PROC_HIT_NORMAL, 0, 0, false },
55 { PROC_FLAG_DONE_MAINHAND_ATTACK, "DoneMainhand", PROC_HIT_NORMAL, 0, 0, false },
56 { PROC_FLAG_DONE_OFFHAND_ATTACK, "DoneOffhand", PROC_HIT_NORMAL, 0, 0, false },
73 { PROC_FLAG_TAKEN_DAMAGE, "TakenDamage", PROC_HIT_NORMAL, 0, 0, false },
74 { PROC_FLAG_KILL, "Kill", 0, 0, 0, false },
75 { PROC_FLAG_KILLED, "Killed", 0, 0, 0, false },
76 { PROC_FLAG_DEATH, "Death", 0, 0, 0, false },
78};

Referenced by SpellProcDatabaseTest::FindMatchingScenario(), and TEST_F().