diff options
author | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2021-09-05 20:37:19 -0500 |
---|---|---|
committer | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2021-09-05 20:37:19 -0500 |
commit | f5b60238e05b124eb40f805eb4a0bbfc0b043da5 (patch) | |
tree | f461bff108f5ddafc4078aa7394d7bf2a6309cc9 /testcase.go | |
parent | 8f22bd4f5b4eb6996c524bcb6948d36cef0ac822 (diff) | |
parent | fd66fb134967067ed7e1c3182325f646b73c730b (diff) | |
download | deb-planr-f5b60238e05b124eb40f805eb4a0bbfc0b043da5.tar.xz deb-planr-f5b60238e05b124eb40f805eb4a0bbfc0b043da5.zip |
Merge branch 'upstream' into ppa
Merge v0.1.0
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 } |