aboutsummaryrefslogtreecommitdiff
path: root/runner.go
diff options
context:
space:
mode:
Diffstat (limited to 'runner.go')
-rw-r--r--runner.go38
1 files changed, 25 insertions, 13 deletions
diff --git a/runner.go b/runner.go
index 5b76cf1..96bcd19 100644
--- a/runner.go
+++ b/runner.go
@@ -27,15 +27,22 @@ func (r Runner) buildTcLUT(tcs []TestCase) TcTab {
for i := range tcs {
tc := &tcs[i]
- for nm := range tc.Config.adapters_ {
- m[nm] = append(m[nm], tc)
- }
+ nm := *tc.Config.Adapter
+ m[nm] = append(m[nm], tc)
}
return m
}
-func (r Runner) Build(tcs []TestCase) {
+func (r Runner) checkConfig(tcs []TestCase) {
+ for _, tc := range tcs {
+ tc.Config.ensureSatisfied(tc.Path)
+ }
+}
+
+func (r Runner) build(tcs []TestCase) {
+ r.checkConfig(tcs)
+
tcTab := r.buildTcLUT(tcs)
for _, adapter := range r.adapters {
@@ -46,9 +53,17 @@ func (r Runner) Build(tcs []TestCase) {
}
}
-func (r Runner) Evaluate(tcs []TestCase) []TestResult {
+func (r Runner) units(root string) []TestCase {
+ return collectUnits(root, r.adapterCfgs())
+}
+
+func (r Runner) Build(root string) {
+ units := r.units(root)
+ r.build(units)
+}
+
+func (r Runner) evaluate(tcs []TestCase) {
tcTab := r.buildTcLUT(tcs)
- results := make([]TestResult, 0)
for _, adapter := range r.adapters {
nm := adapter.Config().Name
@@ -57,15 +72,12 @@ func (r Runner) Evaluate(tcs []TestCase) []TestResult {
adapter.Evaluate(tcTab[nm])
}
- return results
}
+func (r Runner) Evaluate(root string) []TestCase {
+ units := r.units(root)
-func (r Runner) Run(root string) [] TestResult {
- tcs := collectUnits(root, r.adapterCfgs())
-
- r.Build(tcs)
- trs := r.Evaluate(tcs)
+ r.evaluate(units)
- return trs
+ return units
}