From 043be96efbcb093e6538bb214974db143567175d Mon Sep 17 00:00:00 2001 From: Flu0r1ne Date: Thu, 5 Aug 2021 20:30:21 -0500 Subject: License --- cmd/sub/evaluate.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'cmd') 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) } -- cgit v1.2.3