23 lines
621 B
Go
23 lines
621 B
Go
package settings
|
|
|
|
import "testing"
|
|
|
|
func TestDefaultRarityDistributionIsValid(t *testing.T) {
|
|
v := Defaults()
|
|
if err := Validate(v); err != nil {
|
|
t.Fatalf("defaults invalid: %v", err)
|
|
}
|
|
total := v.ArtifactRarityCommonPct + v.ArtifactRarityUncommonPct + v.ArtifactRarityRarePct + v.ArtifactRarityUltraRarePct + v.ArtifactRaritySpecialIllustrationPct
|
|
if total != 100 {
|
|
t.Fatalf("rarity total = %.4f, want 100", total)
|
|
}
|
|
}
|
|
|
|
func TestRarityDistributionMustSumTo100(t *testing.T) {
|
|
v := Defaults()
|
|
v.ArtifactRarityCommonPct = 50
|
|
if err := Validate(v); err == nil {
|
|
t.Fatal("expected invalid rarity total")
|
|
}
|
|
}
|