All checks were successful
build-dsl-smoke / Discover matrix (push) Successful in 8s
build-dsl-smoke / Build judge (push) Successful in 11s
build-dsl-smoke / ${{ matrix.cell.build }} / ${{ matrix.cell.toolchain }} / ${{ matrix.cell.platform }} (push) Successful in 5s
memory-limit / Build judge (pull_request) Successful in 10s
build-dsl-smoke / SUMMARY (push) Successful in 3s
memory-limit / Linux / gcc (pull_request) Successful in 9s
memory-limit / Linux / clang (pull_request) Successful in 13s
memory-limit / Windows / clang (pull_request) Successful in 16s
memory-limit / Windows / msvc (pull_request) Successful in 17s
58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
package runner
|
|
|
|
import "testing"
|
|
|
|
func TestAggregateScoreEmpty(t *testing.T) {
|
|
r := &SuiteResult{}
|
|
if got := r.AggregateScore(); got != 0 {
|
|
t.Errorf("empty aggregate = %v, want 0", got)
|
|
}
|
|
}
|
|
|
|
func TestAggregateScoreSingleBuild(t *testing.T) {
|
|
r := &SuiteResult{
|
|
Builds: []*BuildRun{{Name: "release", TotalScore: 0.75}},
|
|
}
|
|
if got := r.AggregateScore(); got != 0.75 {
|
|
t.Errorf("single build aggregate = %v, want 0.75", got)
|
|
}
|
|
}
|
|
|
|
func TestAggregateScoreTakesMinimum(t *testing.T) {
|
|
r := &SuiteResult{
|
|
Builds: []*BuildRun{
|
|
{Name: "release", TotalScore: 1.0},
|
|
{Name: "debug", TotalScore: 0.9},
|
|
{Name: "sanitized", TotalScore: 0.95},
|
|
},
|
|
}
|
|
if got := r.AggregateScore(); got != 0.9 {
|
|
t.Errorf("aggregate = %v, want 0.9 (minimum)", got)
|
|
}
|
|
}
|
|
|
|
func TestAggregateScoreIgnoresSkipped(t *testing.T) {
|
|
r := &SuiteResult{
|
|
Builds: []*BuildRun{
|
|
{Name: "release", TotalScore: 1.0},
|
|
{Name: "sanitized", Skipped: true, SkipReason: "platforms=linux"},
|
|
{Name: "debug", TotalScore: 0.8},
|
|
},
|
|
}
|
|
if got := r.AggregateScore(); got != 0.8 {
|
|
t.Errorf("aggregate with skipped = %v, want 0.8", got)
|
|
}
|
|
}
|
|
|
|
func TestAggregateScoreAllSkipped(t *testing.T) {
|
|
r := &SuiteResult{
|
|
Builds: []*BuildRun{
|
|
{Name: "a", Skipped: true},
|
|
{Name: "b", Skipped: true},
|
|
},
|
|
}
|
|
if got := r.AggregateScore(); got != 1.0 {
|
|
t.Errorf("all-skipped aggregate = %v, want 1.0", got)
|
|
}
|
|
}
|