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