AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
FormulasTest.cpp File Reference
#include "DBCStores.h"
#include "Formulas.h"
#include "WorldMock.h"
#include "gtest/gtest.h"

Go to the source code of this file.

Functions

 TEST (FormulasTest, hk_honor_at_level)
 
 TEST (FormulasTest, GetGrayLevel)
 
 TEST (FormulasTest, GetColorCode)
 
 TEST (FormulasTest, GetZeroDifference)
 
 TEST (FormulasTest, BaseGain)
 
 TEST (FormulasTest, Gain)
 

Function Documentation

◆ TEST() [1/6]

TEST ( FormulasTest  ,
BaseGain   
)
92{
93 EXPECT_EQ(BaseGain(60, 40, CONTENT_1_60), 0);
94 EXPECT_EQ(BaseGain(60, 60, CONTENT_1_60), 345);
95 EXPECT_EQ(BaseGain(50, 60, CONTENT_1_60), 354);
96 EXPECT_EQ(BaseGain(65, 66, CONTENT_61_70), 588);
97 EXPECT_EQ(BaseGain(79, 78, CONTENT_71_80), 917);
98
99 // check outError() has been called after passing an invalid ContentLevels content
100 EXPECT_EQ(BaseGain(79, 1, ContentLevels(999)), 0);
101}
ContentLevels
Definition: DBCStores.h:41
@ CONTENT_61_70
Definition: DBCStores.h:43
@ CONTENT_71_80
Definition: DBCStores.h:44
@ CONTENT_1_60
Definition: DBCStores.h:42
uint32 BaseGain(uint8 pl_level, uint8 mob_level, ContentLevels content)
Definition: Formulas.cpp:25

References Acore::XP::BaseGain(), CONTENT_1_60, CONTENT_61_70, and CONTENT_71_80.

◆ TEST() [2/6]

TEST ( FormulasTest  ,
Gain   
)
Todo:
: create mocks of Player and Creature
104{
105 auto worldMock = new WorldMock();
106 sWorld.reset((worldMock));
108 // Gain(nullptr, nullptr);
109}
#define sWorld
Definition: World.h:443
Definition: WorldMock.h:32

References sWorld.

◆ TEST() [3/6]

TEST ( FormulasTest  ,
GetColorCode   
)
50{
51 EXPECT_EQ(GetColorCode(60, 80), XP_RED);
52 EXPECT_EQ(GetColorCode(60, 65), XP_RED);
53 EXPECT_EQ(GetColorCode(60, 64), XP_ORANGE);
54 EXPECT_EQ(GetColorCode(60, 63), XP_ORANGE);
55 EXPECT_EQ(GetColorCode(60, 62), XP_YELLOW);
56 EXPECT_EQ(GetColorCode(60, 58), XP_YELLOW);
57 EXPECT_EQ(GetColorCode(60, 57), XP_GREEN);
58 EXPECT_EQ(GetColorCode(60, 52), XP_GREEN);
59 EXPECT_EQ(GetColorCode(60, 51), XP_GRAY);
60 EXPECT_EQ(GetColorCode(60, 1), XP_GRAY);
61}
@ XP_GREEN
Definition: SharedDefines.h:3581
@ XP_GRAY
Definition: SharedDefines.h:3582
@ XP_YELLOW
Definition: SharedDefines.h:3580
@ XP_RED
Definition: SharedDefines.h:3578
@ XP_ORANGE
Definition: SharedDefines.h:3579
XPColorChar GetColorCode(uint8 pl_level, uint8 mob_level)
Definition: Formulas.h:63

References Acore::XP::GetColorCode(), XP_GRAY, XP_GREEN, XP_ORANGE, XP_RED, and XP_YELLOW.

◆ TEST() [4/6]

TEST ( FormulasTest  ,
GetGrayLevel   
)
38{
39 EXPECT_EQ(GetGrayLevel(0), 0);
40 EXPECT_EQ(GetGrayLevel(5), 0);
41 EXPECT_EQ(GetGrayLevel(6), 1);
42 EXPECT_EQ(GetGrayLevel(39), 31);
43 EXPECT_EQ(GetGrayLevel(40), 31);
44 EXPECT_EQ(GetGrayLevel(59), 47);
45 EXPECT_EQ(GetGrayLevel(60), 51);
46 EXPECT_EQ(GetGrayLevel(80), 71);
47}
uint8 GetGrayLevel(uint8 pl_level)
Definition: Formulas.h:46

References Acore::XP::GetGrayLevel().

◆ TEST() [5/6]

TEST ( FormulasTest  ,
GetZeroDifference   
)
64{
65 EXPECT_EQ(GetZeroDifference(1), 5);
66 EXPECT_EQ(GetZeroDifference(7), 5);
67 EXPECT_EQ(GetZeroDifference(8), 6);
68 EXPECT_EQ(GetZeroDifference(9), 6);
69 EXPECT_EQ(GetZeroDifference(10), 7);
70 EXPECT_EQ(GetZeroDifference(11), 7);
71 EXPECT_EQ(GetZeroDifference(12), 8);
72 EXPECT_EQ(GetZeroDifference(15), 8);
73 EXPECT_EQ(GetZeroDifference(16), 9);
74 EXPECT_EQ(GetZeroDifference(19), 9);
75 EXPECT_EQ(GetZeroDifference(20), 11);
76 EXPECT_EQ(GetZeroDifference(29), 11);
77 EXPECT_EQ(GetZeroDifference(30), 12);
78 EXPECT_EQ(GetZeroDifference(39), 12);
79 EXPECT_EQ(GetZeroDifference(40), 13);
80 EXPECT_EQ(GetZeroDifference(44), 13);
81 EXPECT_EQ(GetZeroDifference(45), 14);
82 EXPECT_EQ(GetZeroDifference(49), 14);
83 EXPECT_EQ(GetZeroDifference(50), 15);
84 EXPECT_EQ(GetZeroDifference(54), 15);
85 EXPECT_EQ(GetZeroDifference(55), 16);
86 EXPECT_EQ(GetZeroDifference(59), 16);
87 EXPECT_EQ(GetZeroDifference(60), 17);
88 EXPECT_EQ(GetZeroDifference(80), 17);
89}
uint8 GetZeroDifference(uint8 pl_level)
Definition: Formulas.h:82

References Acore::XP::GetZeroDifference().

◆ TEST() [6/6]

TEST ( FormulasTest  ,
hk_honor_at_level   
)
27{
28 EXPECT_EQ(hk_honor_at_level(80), 124);
29 EXPECT_EQ(hk_honor_at_level(80, 2), 248);
30 EXPECT_EQ(hk_honor_at_level(80, 0.5), 62);
31 EXPECT_EQ(hk_honor_at_level(1), 2);
32 EXPECT_EQ(hk_honor_at_level(1, 10), 16);
33 EXPECT_EQ(hk_honor_at_level(2), 4);
34 EXPECT_EQ(hk_honor_at_level(3), 5);
35}
uint32 hk_honor_at_level(uint8 level, float multiplier=1.0f)
Definition: Formulas.h:38

References Acore::Honor::hk_honor_at_level().