diff options
Diffstat (limited to 'cmd/sub/evaluate.go')
-rw-r--r-- | cmd/sub/evaluate.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/cmd/sub/evaluate.go b/cmd/sub/evaluate.go index a0f858b..1174b3f 100644 --- a/cmd/sub/evaluate.go +++ b/cmd/sub/evaluate.go @@ -12,6 +12,8 @@ func Evaluate(params []string) { fmt.Printf("\n\nREPORT:\n=======\n\n") + earned := 0.0 + total := 0.0 for _, tc := range tcs { cfg := tc.Config @@ -20,19 +22,22 @@ func Evaluate(params []string) { name = *cfg.Title } - status := "NOT RUN" + var points float64 = 0.0 + if cfg.Points != nil { + points = float64(*cfg.Points) + } + + status := "SILENT" if tc.Result != nil { if tc.Result.Pass { status = "PASS" + earned += points } else { status = "FAIL" } } - var points float32 = 0.0 - if cfg.Points != nil { - points = *cfg.Points - } + total += points fmt.Printf("[%s] %s (%f)\n", status, name, points) @@ -42,4 +47,6 @@ func Evaluate(params []string) { fmt.Println() } + + fmt.Printf("Score: %f (%f%%)\n", earned, (earned / total) * 100) } |