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

Tests for Ulduar vehicle gear scaling formula. More...

#include "gtest/gtest.h"
#include <algorithm>
#include <cmath>
#include <cstdint>

Go to the source code of this file.

Classes

class  UlduarVehicleScaleTest
 

Functions

 TEST_F (UlduarVehicleScaleTest, BaselineNoGear)
 
 TEST_F (UlduarVehicleScaleTest, MinimumScalingThreshold)
 
 TEST_F (UlduarVehicleScaleTest, NaxxramasEntryGear)
 
 TEST_F (UlduarVehicleScaleTest, NaxxramasBiSGear)
 
 TEST_F (UlduarVehicleScaleTest, Ulduar10Gear)
 
 TEST_F (UlduarVehicleScaleTest, Ulduar25Gear)
 
 TEST_F (UlduarVehicleScaleTest, UlduarBiSGear)
 
 TEST_F (UlduarVehicleScaleTest, ToCBiSGear)
 
 TEST_F (UlduarVehicleScaleTest, ICCBiSGear)
 
 TEST_F (UlduarVehicleScaleTest, RSBiSGear)
 
 TEST_F (UlduarVehicleScaleTest, AllEpicNoPenalty)
 
 TEST_F (UlduarVehicleScaleTest, OneRareItemPenalty)
 
 TEST_F (UlduarVehicleScaleTest, OneUncommonItemPenalty)
 
 TEST_F (UlduarVehicleScaleTest, MixedQualityPenalty)
 
 TEST_F (UlduarVehicleScaleTest, FloorAtLowItemLevel)
 
 TEST_F (UlduarVehicleScaleTest, FloorWithQualityPenalty)
 
 TEST_F (UlduarVehicleScaleTest, MonotonicWithSameQuality)
 
 TEST_F (UlduarVehicleScaleTest, MonotonicAmountWithSameQuality)
 

Detailed Description

Tests for Ulduar vehicle gear scaling formula.

Formula (from spell_gen_vehicle_scaling_aura in spell_generic.cpp):

result = (totalAdjustedILvl - 2500) / 500 amount = int32(max(0.1f, result))

Where: totalAdjustedILvl = sum of GetItemLevelIncludingQuality across 15 equipped slots (excludes offhand, ranged, shirt, tabard) GetItemLevelIncludingQuality bakes in quality penalty: -26 for uncommon/below, -13 for rare; heirloom items use pLevel * 2.33f instead of base ItemLevel. floor: 0.1 when totalAdjustedILvl < 2500

Source data: Google Sheets "Ulduar Vehicle Scaling" Vehicle: Salvaged Demolisher (entry 33109)

Definition in file VehicleScalingUlduarTest.cpp.

Function Documentation

◆ TEST_F() [1/18]

TEST_F ( UlduarVehicleScaleTest  ,
AllEpicNoPenalty   
)
165{
166 // 15 epic items at avg 200: totalAdjustedILvl = 15 * 200 = 3000
167 // (3000 - 2500) / 500 = 1.0
168 float result = CalcUlduarVehicleScale(3000.0f);
169 EXPECT_FLOAT_EQ(result, 1.0f);
170}

◆ TEST_F() [2/18]

TEST_F ( UlduarVehicleScaleTest  ,
BaselineNoGear   
)
71{
72 // totalILvl = 2500 (e.g. 15 items at avg 166.67)
73 // Formula gives 0. Floor at 0.1 -> 0.1, int32 truncates to 0
74 float result = CalcUlduarVehicleScale(2500.0f);
75 EXPECT_FLOAT_EQ(result, 0.1f);
76 EXPECT_EQ(CalcUlduarVehicleScaleAmount(2500.0f), 0);
77}

◆ TEST_F() [3/18]

TEST_F ( UlduarVehicleScaleTest  ,
FloorAtLowItemLevel   
)
204{
205 // totalILvl < 2500 → result would be negative, floor to 0.1
206 float result = CalcUlduarVehicleScale(2400.0f);
207 EXPECT_FLOAT_EQ(result, 0.1f);
208 EXPECT_EQ(CalcUlduarVehicleScaleAmount(2400.0f), 0);
209}

◆ TEST_F() [4/18]

TEST_F ( UlduarVehicleScaleTest  ,
FloorWithQualityPenalty   
)
212{
213 // totalAdjustedILvl = 2400 (e.g. sum of quality-adjusted iLvl below 2500)
214 // (2400 - 2500) / 500 = -0.2 → floor to 0.1
215 float result = CalcUlduarVehicleScale(2400.0f);
216 EXPECT_FLOAT_EQ(result, 0.1f);
217 EXPECT_EQ(CalcUlduarVehicleScaleAmount(2400.0f), 0);
218}

◆ TEST_F() [5/18]

TEST_F ( UlduarVehicleScaleTest  ,
ICCBiSGear   
)
143{
144 // totalILvl = 4162 (avg 277.5 * 15 items, ICC BiS)
145 // (4162 - 2500) / 500 = 3.324
146 float result = CalcUlduarVehicleScale(4162.0f);
147 EXPECT_FLOAT_EQ(result, 3.324f);
148 EXPECT_EQ(CalcUlduarVehicleScaleAmount(4162.0f), 3);
149}

◆ TEST_F() [6/18]

TEST_F ( UlduarVehicleScaleTest  ,
MinimumScalingThreshold   
)
80{
81 // totalILvl = 2550 -> (2550-2500)/500 = 0.1
82 // At this threshold, floor matches formula
83 float result = CalcUlduarVehicleScale(2550.0f);
84 EXPECT_FLOAT_EQ(result, 0.1f);
85 EXPECT_EQ(CalcUlduarVehicleScaleAmount(2550.0f), 0);
86}

◆ TEST_F() [7/18]

TEST_F ( UlduarVehicleScaleTest  ,
MixedQualityPenalty   
)
191{
192 // 10 epic (200) + 3 rare (187) + 2 uncommon (174):
193 // totalAdjustedILvl = 10*200 + 3*187 + 2*174 = 2000 + 561 + 348 = 2909
194 // (2909 - 2500) / 500 = 409/500 = 0.818
195 float result = CalcUlduarVehicleScale(2909.0f);
196 EXPECT_FLOAT_EQ(result, 0.818f);
197}

◆ TEST_F() [8/18]

TEST_F ( UlduarVehicleScaleTest  ,
MonotonicAmountWithSameQuality   
)
236{
237 int32_t prev = CalcUlduarVehicleScaleAmount(2500.0f);
238 for (float totalILvl = 2510.0f; totalILvl <= 4000.0f; totalILvl += 10.0f)
239 {
240 int32_t curr = CalcUlduarVehicleScaleAmount(totalILvl);
241 EXPECT_GE(curr, prev) << "Amount dropped at totalILvl=" << totalILvl;
242 prev = curr;
243 }
244}

◆ TEST_F() [9/18]

TEST_F ( UlduarVehicleScaleTest  ,
MonotonicWithSameQuality   
)
225{
226 float prev = CalcUlduarVehicleScale(2500.0f);
227 for (float totalILvl = 2510.0f; totalILvl <= 4000.0f; totalILvl += 10.0f)
228 {
229 float curr = CalcUlduarVehicleScale(totalILvl);
230 EXPECT_GE(curr, prev) << "Scaling dropped at totalILvl=" << totalILvl;
231 prev = curr;
232 }
233}

◆ TEST_F() [10/18]

TEST_F ( UlduarVehicleScaleTest  ,
NaxxramasBiSGear   
)
98{
99 // totalILvl = 3000 (avg 200 * 15 items, Naxx BiS / Ulduar entry)
100 // (3000 - 2500) / 500 = 1.0
101 float result = CalcUlduarVehicleScale(3000.0f);
102 EXPECT_FLOAT_EQ(result, 1.0f);
103 EXPECT_EQ(CalcUlduarVehicleScaleAmount(3000.0f), 1);
104}

◆ TEST_F() [11/18]

TEST_F ( UlduarVehicleScaleTest  ,
NaxxramasEntryGear   
)
89{
90 // totalILvl = 2805 (avg 187 * 15 items, typical Naxx entry)
91 // (2805 - 2500) / 500 = 0.61
92 float result = CalcUlduarVehicleScale(2805.0f);
93 EXPECT_FLOAT_EQ(result, 0.61f);
94 EXPECT_EQ(CalcUlduarVehicleScaleAmount(2805.0f), 0);
95}

◆ TEST_F() [12/18]

TEST_F ( UlduarVehicleScaleTest  ,
OneRareItemPenalty   
)
173{
174 // 14 epic (200) + 1 rare (200 - 13 = 187): totalAdjustedILvl = 14*200 + 187 = 2987
175 // (2987 - 2500) / 500 = 487/500 = 0.974
176 float result = CalcUlduarVehicleScale(2987.0f);
177 EXPECT_FLOAT_EQ(result, 0.974f);
178 EXPECT_EQ(CalcUlduarVehicleScaleAmount(2987.0f), 0);
179}

◆ TEST_F() [13/18]

TEST_F ( UlduarVehicleScaleTest  ,
OneUncommonItemPenalty   
)
182{
183 // 14 epic (200) + 1 uncommon (200 - 26 = 174): totalAdjustedILvl = 14*200 + 174 = 2974
184 // (2974 - 2500) / 500 = 474/500 = 0.948
185 float result = CalcUlduarVehicleScale(2974.0f);
186 EXPECT_FLOAT_EQ(result, 0.948f);
187 EXPECT_EQ(CalcUlduarVehicleScaleAmount(2974.0f), 0);
188}

◆ TEST_F() [14/18]

TEST_F ( UlduarVehicleScaleTest  ,
RSBiSGear   
)
152{
153 // totalILvl = 4204 (avg 280.3 * 15 items, RS BiS)
154 // (4204 - 2500) / 500 = 3.408
155 float result = CalcUlduarVehicleScale(4204.0f);
156 EXPECT_FLOAT_EQ(result, 3.408f);
157 EXPECT_EQ(CalcUlduarVehicleScaleAmount(4204.0f), 3);
158}

◆ TEST_F() [15/18]

TEST_F ( UlduarVehicleScaleTest  ,
ToCBiSGear   
)
134{
135 // totalILvl = 3884 (avg 258.9 * 15 items, ToGC BiS)
136 // (3884 - 2500) / 500 = 2.768
137 float result = CalcUlduarVehicleScale(3884.0f);
138 EXPECT_FLOAT_EQ(result, 2.768f);
139 EXPECT_EQ(CalcUlduarVehicleScaleAmount(3884.0f), 2);
140}

◆ TEST_F() [16/18]

TEST_F ( UlduarVehicleScaleTest  ,
Ulduar10Gear   
)
107{
108 // totalILvl = 3195 (avg 213 * 15 items, Ulduar 10)
109 // (3195 - 2500) / 500 = 1.39
110 float result = CalcUlduarVehicleScale(3195.0f);
111 EXPECT_FLOAT_EQ(result, 1.39f);
112 EXPECT_EQ(CalcUlduarVehicleScaleAmount(3195.0f), 1);
113}

◆ TEST_F() [17/18]

TEST_F ( UlduarVehicleScaleTest  ,
Ulduar25Gear   
)
116{
117 // totalILvl = 3390 (avg 226 * 15 items, Ulduar 25)
118 // (3390 - 2500) / 500 = 1.78
119 float result = CalcUlduarVehicleScale(3390.0f);
120 EXPECT_FLOAT_EQ(result, 1.78f);
121 EXPECT_EQ(CalcUlduarVehicleScaleAmount(3390.0f), 1);
122}

◆ TEST_F() [18/18]

TEST_F ( UlduarVehicleScaleTest  ,
UlduarBiSGear   
)
125{
126 // totalILvl = 3780 (avg 252 * 15 items, Ulduar BiS)
127 // (3780 - 2500) / 500 = 2.56
128 float result = CalcUlduarVehicleScale(3780.0f);
129 EXPECT_FLOAT_EQ(result, 2.56f);
130 EXPECT_EQ(CalcUlduarVehicleScaleAmount(3780.0f), 2);
131}