diff options
Diffstat (limited to 'testcase.go')
-rw-r--r-- | testcase.go | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/testcase.go b/testcase.go index 8506b84..d1db292 100644 --- a/testcase.go +++ b/testcase.go @@ -1,9 +1,14 @@ package planr +import ( + "log" +) + type TestStatus uint const ( - PASSING TestStatus = iota + NOT_RUN TestStatus = iota + PASSING COMPILATION_FAILURE RUNTIME_FAILURE ) @@ -13,6 +18,20 @@ type TestResult struct { Status TestStatus DebugOutput string TestOutput string + Tc TestCase +} + +// Program-wide testcase config +type TestCaseConfig struct { + Defaults + Title *string + Description *string +} + +func (c TestCaseConfig) ensureSatisfied(name string) { + if (c.Adapter == nil) { + log.Fatalf("Adapter must be provided for testcase %s", name) + } } type TestCase struct { @@ -26,11 +45,17 @@ type TestCase struct { Cname string Config TestCaseConfig - - Result *TestResult - + + // Reorder according to original read order after concurrent operation + readIdx int } func (tc TestCase) AdapterConfig() InheritableConfig { return tc.Config.adapters_[*tc.Config.Adapter] } + +type ByReadIdx []TestResult + +func (a ByReadIdx) Len() int { return len(a) } +func (a ByReadIdx) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a ByReadIdx) Less(i, j int) bool { return a[i].Tc.readIdx < a[j].Tc.readIdx } |