-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseason_planner_test.go
More file actions
35 lines (31 loc) · 915 Bytes
/
season_planner_test.go
File metadata and controls
35 lines (31 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import "testing"
func TestParseWinProbPct(t *testing.T) {
if got := parseWinProbPct("62% You"); got != 62 {
t.Fatalf("expected 62, got %d", got)
}
if got := parseWinProbPct(""); got != 0 {
t.Fatalf("expected 0 for empty, got %d", got)
}
if got := parseWinProbPct("bad"); got != 0 {
t.Fatalf("expected 0 for invalid, got %d", got)
}
}
func TestBuildScheduleDifficultyProfile(t *testing.T) {
league := LeagueData{
HasMatchups: true,
LeagueSize: 12,
WinProb: "35% You",
PowerRankings: []PowerRanking{
{IsUserTeam: true, StandingRank: 2, ValueRank: 9},
},
}
diff, _ := buildScheduleDifficultyProfile(league, "Contending")
if diff != "Hard" {
t.Fatalf("expected Hard difficulty, got %s", diff)
}
off, _ := buildScheduleDifficultyProfile(LeagueData{HasMatchups: false}, "Build")
if off != "Offseason" {
t.Fatalf("expected Offseason difficulty, got %s", off)
}
}