mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -04:00
Correct foul values for 2019.
This commit is contained in:
@@ -55,10 +55,10 @@ var Rules = []Rule{
|
||||
|
||||
func (foul *Foul) PointValue() int {
|
||||
if foul.IsTechnical {
|
||||
return 25
|
||||
return 10
|
||||
} else if foul.IsRankingPoint {
|
||||
return 0
|
||||
} else {
|
||||
return 5
|
||||
return 3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,15 +24,15 @@ func TestAddScoreSummary(t *testing.T) {
|
||||
|
||||
// Add a win.
|
||||
rankingFields.AddScoreSummary(blueSummary, redSummary, false)
|
||||
assert.Equal(t, RankingFields{4, 42, 20, 27, 15, 0.24496508529377975, 1, 1, 0, 0, 2}, rankingFields)
|
||||
assert.Equal(t, RankingFields{4, 48, 24, 33, 15, 0.24496508529377975, 1, 1, 0, 0, 2}, rankingFields)
|
||||
|
||||
// Add a tie.
|
||||
rankingFields.AddScoreSummary(redSummary, redSummary, false)
|
||||
assert.Equal(t, RankingFields{6, 72, 40, 39, 24, 0.6559562651954052, 1, 1, 1, 0, 3}, rankingFields)
|
||||
assert.Equal(t, RankingFields{6, 78, 44, 45, 24, 0.6559562651954052, 1, 1, 1, 0, 3}, rankingFields)
|
||||
|
||||
// Add a disqualification.
|
||||
rankingFields.AddScoreSummary(blueSummary, redSummary, true)
|
||||
assert.Equal(t, RankingFields{6, 72, 40, 39, 24, 0.6559562651954052, 1, 1, 1, 1, 4}, rankingFields)
|
||||
assert.Equal(t, RankingFields{6, 78, 44, 45, 24, 0.6559562651954052, 1, 1, 1, 1, 4}, rankingFields)
|
||||
}
|
||||
|
||||
func TestSortRankings(t *testing.T) {
|
||||
|
||||
@@ -23,12 +23,12 @@ func TestScoreSummary(t *testing.T) {
|
||||
assert.Equal(t, false, redSummary.HabDocking)
|
||||
|
||||
blueSummary := blueScore.Summarize(redScore.Fouls)
|
||||
assert.Equal(t, 12, blueSummary.CargoPoints)
|
||||
assert.Equal(t, 0, blueSummary.HatchPanelPoints)
|
||||
assert.Equal(t, 15, blueSummary.HabClimbPoints)
|
||||
assert.Equal(t, 18, blueSummary.CargoPoints)
|
||||
assert.Equal(t, 4, blueSummary.HatchPanelPoints)
|
||||
assert.Equal(t, 21, blueSummary.HabClimbPoints)
|
||||
assert.Equal(t, 6, blueSummary.SandstormBonusPoints)
|
||||
assert.Equal(t, 55, blueSummary.FoulPoints)
|
||||
assert.Equal(t, 88, blueSummary.Score)
|
||||
assert.Equal(t, 23, blueSummary.FoulPoints)
|
||||
assert.Equal(t, 72, blueSummary.Score)
|
||||
assert.Equal(t, false, blueSummary.CompleteRocket)
|
||||
assert.Equal(t, true, blueSummary.HabDocking)
|
||||
|
||||
|
||||
@@ -38,9 +38,9 @@ func TestScore2() *Score {
|
||||
BayHatchCargo},
|
||||
RocketNearLeftBays: [3]BayStatus{BayEmpty, BayEmpty, BayEmpty},
|
||||
RocketNearRightBays: [3]BayStatus{BayEmpty, BayEmpty, BayEmpty},
|
||||
RocketFarLeftBays: [3]BayStatus{BayEmpty, BayEmpty, BayEmpty},
|
||||
RocketFarRightBays: [3]BayStatus{BayEmpty, BayEmpty, BayEmpty},
|
||||
RobotEndLevels: [3]int{1, 2, 2},
|
||||
RocketFarLeftBays: [3]BayStatus{BayHatchCargo, BayEmpty, BayEmpty},
|
||||
RocketFarRightBays: [3]BayStatus{BayEmpty, BayEmpty, BayHatchCargo},
|
||||
RobotEndLevels: [3]int{1, 3, 2},
|
||||
Fouls: []Foul{},
|
||||
ElimDq: false,
|
||||
}
|
||||
|
||||
@@ -177,8 +177,8 @@ func TestCommitEliminationTie(t *testing.T) {
|
||||
matchResult := &model.MatchResult{
|
||||
MatchId: match.Id,
|
||||
RedScore: &game.Score{
|
||||
RocketFarRightBays: [3]game.BayStatus{game.BayHatchCargo, game.BayEmpty, game.BayEmpty},
|
||||
Fouls: []game.Foul{{}}},
|
||||
RocketFarRightBays: [3]game.BayStatus{game.BayHatchCargo, game.BayHatch, game.BayHatch},
|
||||
Fouls: []game.Foul{{}, {}, {}}},
|
||||
BlueScore: &game.Score{},
|
||||
}
|
||||
err := web.commitMatchScore(match, matchResult, false)
|
||||
|
||||
@@ -50,7 +50,7 @@ func TestMatchReviewEditExistingResult(t *testing.T) {
|
||||
assert.Equal(t, 200, recorder.Code)
|
||||
assert.Contains(t, recorder.Body.String(), "QF4-3")
|
||||
assert.Contains(t, recorder.Body.String(), "71") // The red score
|
||||
assert.Contains(t, recorder.Body.String(), "88") // The blue score
|
||||
assert.Contains(t, recorder.Body.String(), "72") // The blue score
|
||||
|
||||
// Check response for non-existent match.
|
||||
recorder = web.getHttpResponse(fmt.Sprintf("/match_review/%d/edit", 12345))
|
||||
@@ -71,7 +71,7 @@ func TestMatchReviewEditExistingResult(t *testing.T) {
|
||||
recorder = web.getHttpResponse("/match_review")
|
||||
assert.Equal(t, 200, recorder.Code)
|
||||
assert.Contains(t, recorder.Body.String(), "QF4-3")
|
||||
assert.Contains(t, recorder.Body.String(), "17") // The red score
|
||||
assert.Contains(t, recorder.Body.String(), "15") // The red score
|
||||
assert.Contains(t, recorder.Body.String(), "19") // The blue score
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user