diff options
author | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-09-05 13:39:34 -0500 |
---|---|---|
committer | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-09-05 13:39:34 -0500 |
commit | 54276b73eacfab6a5d6b899bd638f6cfe9499b80 (patch) | |
tree | 47f08b247e061489c91e9d98500dfd98d53b5d1b /cmd/planr/sub/evaluate.go | |
parent | 7f3a568983470016bf99baafb4db47c8223c0494 (diff) | |
download | deb-planr-54276b73eacfab6a5d6b899bd638f6cfe9499b80.tar.xz deb-planr-54276b73eacfab6a5d6b899bd638f6cfe9499b80.zip |
Refactor with scoring object
Diffstat (limited to 'cmd/planr/sub/evaluate.go')
-rw-r--r-- | cmd/planr/sub/evaluate.go | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/cmd/planr/sub/evaluate.go b/cmd/planr/sub/evaluate.go index c2549be..81c9989 100644 --- a/cmd/planr/sub/evaluate.go +++ b/cmd/planr/sub/evaluate.go @@ -4,36 +4,18 @@ import ( "golang.flu0r1ne.net/planr" ) + func Evaluate(runner planr.Runner, params []string, cfg planr.Config) { dieIncompatibleVersion(cfg) tcs := runner.CollectCases() trs := runner.Evaluate(tcs) - earned := 0.0 - total := 0.0 - passed := 0 - for _, tr := range trs { - cfg := tr.Tc.Config - - if cfg.Points != nil { - points := float64(*cfg.Points) - - total += points - - if tr.Status == planr.PASSING { - earned += points - passed++ - } - } + score := planr.Score(trs) + for _, tr := range trs { tcPprint(tr) } - printResults( - passed, - len(tcs), - earned, - total, - ); + printScoring(score) } |