@@ -35,18 +35,31 @@ describe("TradeQueryGenerator", function()
3535 assert .are .equal (result , 100 )
3636 end )
3737
38- it (" uses minion output for non-FullDPS stats when minion output is available " , function ()
39- local baseOutput = { AverageDamage = 10 , Minion = { AverageDamage = 100 } }
40- local newOutput = { AverageDamage = 10 , Minion = { AverageDamage = 250 } }
41- local statWeights = { { stat = " AverageDamage " , weightMult = 1 } }
38+ it (" uses minion output for non-FullDPS stats when minion output is desired " , function ()
39+ local baseOutput = { Life = 10 , Minion = { Life = 100 } }
40+ local newOutput = { Life = 10 , Minion = { Life = 250 } }
41+ local statWeights = { { stat = " MinionLife " , weightMult = 1 } }
4242 data .misc .maxStatIncrease = 1000
4343
4444 local result = mock_queryGen .WeightedRatioOutputs (baseOutput , newOutput , statWeights )
4545
4646 assert .are .equal (result , 2.5 )
4747 end )
4848
49- it (" uses player output for FullDPS even when minion output is available" , function ()
49+ it (" uses lower is better stats correctly" , function ()
50+ local baseOutput = { MaxHit = 100 }
51+ local newOutput = { MaxHit = 10 }
52+ local statWeights = { { stat = " MaxHit" , weightMult = 1 , transform = function (number ) return - number end } }
53+ data .misc .maxStatIncrease = 1000
54+
55+ local result = mock_queryGen .WeightedRatioOutputs (baseOutput , newOutput , statWeights )
56+
57+ local close_enough = (result - - 0.1 ) < 0.0001
58+ assert .True (close_enough )
59+ end )
60+
61+ it (" uses player and minion output for FullDPS" , function ()
62+ -- minion output gets assigned to the player's full dps in reality
5063 local baseOutput = { FullDPS = 100 , Minion = { FullDPS = 100 } }
5164 local newOutput = { FullDPS = 250 , Minion = { FullDPS = 1000 } }
5265 local statWeights = { { stat = " FullDPS" , weightMult = 1 } }
@@ -57,6 +70,16 @@ describe("TradeQueryGenerator", function()
5770 assert .are .equal (result , 2.5 )
5871 end )
5972
73+ it (" uses player output for non-FullDPS even when minion output is available" , function ()
74+ local baseOutput = { Life = 100 , Minion = { Life = 100 } }
75+ local newOutput = { Life = 250 , Minion = { Life = 1000 } }
76+ local statWeights = { { stat = " Life" , weightMult = 1 } }
77+ data .misc .maxStatIncrease = 1000
78+
79+ local result = mock_queryGen .WeightedRatioOutputs (baseOutput , newOutput , statWeights )
80+ assert .are .equal (result , 2.5 )
81+ end )
82+
6083 it (" uses the fallback DPS ratio once when FullDPS is unavailable" , function ()
6184 local baseOutput = { Minion = { TotalDPS = 10 , TotalDotDPS = 0 , CombinedDPS = 10 } }
6285 local newOutput = { Minion = { TotalDPS = 25 , TotalDotDPS = 0 , CombinedDPS = 25 } }
0 commit comments