forked from leanovate/gopter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_result.go
52 lines (46 loc) · 1.14 KB
/
test_result.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package gopter
import "time"
type testStatus int
const (
// TestPassed indicates that the property check has passed.
TestPassed testStatus = iota
// TestProved indicates that the property has been proved.
TestProved
// TestFailed indicates that the property check has failed.
TestFailed
// TestExhausted indicates that the property check has exhausted, i.e. the generators have
// generated too many empty results.
TestExhausted
// TestError indicates that the property check has finished with an error.
TestError
)
func (s testStatus) String() string {
switch s {
case TestPassed:
return "PASSED"
case TestProved:
return "PROVED"
case TestFailed:
return "FAILED"
case TestExhausted:
return "EXHAUSTED"
case TestError:
return "ERROR"
}
return ""
}
// TestResult contains the result of a property property check.
type TestResult struct {
Status testStatus
Succeeded int
Discarded int
Labels []string
Error error
ErrorStack []byte
Args PropArgs
Time time.Duration
}
// Passed checks if the check has passed
func (r *TestResult) Passed() bool {
return r.Status == TestPassed || r.Status == TestProved
}