aboutsummaryrefslogtreecommitdiff
path: root/testcase.go
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2021-09-05 20:37:19 -0500
committerFurkan Sahin <furkan-dev@proton.me>2021-09-05 20:37:19 -0500
commitc36afa4b348a5450c59645b2be4e513a408fb54d (patch)
tree790801a4ccd23190c6b08a02a6d92c4709ce6010 /testcase.go
parent988becbc29376314b560927043669ba32deaf0d5 (diff)
parent4b964d0d7b0d77d4cfcc6ddc1be1d3373cef82b2 (diff)
Merge branch 'upstream' into ppa
Merge v0.1.0
Diffstat (limited to 'testcase.go')
-rw-r--r--testcase.go33
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 }