diff options
author | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-08-05 20:30:21 -0500 |
---|---|---|
committer | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-08-05 20:30:21 -0500 |
commit | 043be96efbcb093e6538bb214974db143567175d (patch) | |
tree | 366cd4b648b754d36c44a580a0dd53d4081cd6c1 /cmd/sub | |
parent | cbc5fbdf941cd40dc6a9546fb924689f5d6978c7 (diff) | |
download | planr-043be96efbcb093e6538bb214974db143567175d.tar.xz planr-043be96efbcb093e6538bb214974db143567175d.zip |
License
Diffstat (limited to 'cmd/sub')
-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) } |