46 lines
1.4 KiB
Go
46 lines
1.4 KiB
Go
package gameserver
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestSrtoolCustomBattleIsLimitedToClientCalyxRows(t *testing.T) {
|
|
chdirRepositoryRoot(t)
|
|
resources, err := loadWorldBattleResources()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
seenCalyx, seenStagnantShadow, seenCavern := false, false, false
|
|
for _, row := range resources.Cocoons {
|
|
if row.CocoonType == 0 {
|
|
t.Fatalf("Client Cocoon row %d at world level %d has no CocoonType", row.ID, row.WorldLevel)
|
|
}
|
|
allowed := canUseSrtoolCustomCocoon(row)
|
|
switch row.CocoonType {
|
|
case clientCocoonTypeCalyx:
|
|
seenCalyx = true
|
|
if !allowed {
|
|
t.Errorf("Calyx row %d at world level %d must allow FreeSR custom battles", row.ID, row.WorldLevel)
|
|
}
|
|
case clientCocoonTypeStagnantShadow:
|
|
seenStagnantShadow = true
|
|
if allowed {
|
|
t.Errorf("Stagnant Shadow row %d at world level %d must use its Client stage", row.ID, row.WorldLevel)
|
|
}
|
|
case clientCocoonTypeCavernCorrosion:
|
|
seenCavern = true
|
|
if allowed {
|
|
t.Errorf("Cavern row %d at world level %d must use its Client stage", row.ID, row.WorldLevel)
|
|
}
|
|
default:
|
|
if allowed {
|
|
t.Errorf("unknown Client CocoonType %d must not allow FreeSR custom battles", row.CocoonType)
|
|
}
|
|
}
|
|
}
|
|
if !seenCalyx || !seenStagnantShadow || !seenCavern {
|
|
t.Fatalf("Client Cocoon resource must cover Calyx, Stagnant Shadow, and Cavern; got calyx=%t stagnant=%t cavern=%t", seenCalyx, seenStagnantShadow, seenCavern)
|
|
}
|
|
}
|