26 lines
1000 B
Go
26 lines
1000 B
Go
package sdkserver
|
|||
|
|
|
||
|
|
import (
|
||
|
|
pb "gac-hkrpg-go/protocol/proto"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestLiveNativeDictionariesSupplyBreakdownWithoutReplacingAggregate(t *testing.T) {
|
||
|
|
avatars := []*pb.AvatarBattleInfo{{Id: 10, TotalDamage: 1200}, {Id: 11}}
|
||
|
|
err := applyLiveAvatarBreakdowns(avatars, []liveAvatarBreakdown{
|
||
|
|
{Damage: map[string]float64{"ElationDamage": 700, "TrueDamage": 300}, MaxDamage: map[string]float64{"ElationDamage": 400}},
|
||
|
|
{Damage: map[string]float64{}},
|
||
|
|
})
|
||
|
|
if err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
if avatars[0].TotalDamage != 1200 || len(avatars[0].AttackTypeDamage) != 2 || avatars[0].AttackTypeMaxDamage[0].Damage != 400 || len(avatars[1].AttackTypeDamage) != 0 {
|
||
|
|
t.Fatalf("native data was replaced or lost: %v", avatars)
|
||
|
|
}
|
||
|
|
if err := applyLiveAvatarBreakdowns(avatars, []liveAvatarBreakdown{{}}); err == nil {
|
||
|
|
t.Fatal("accepted a mismatched avatar count")
|
||
|
|
}
|
||
|
|
if _, err := liveDamageProperties(map[string]float64{"Normal": -1}); err == nil {
|
||
|
|
t.Fatal("accepted negative damage")
|
||
|
|
}
|
||
|
|
}
|