-
Notifications
You must be signed in to change notification settings - Fork 40
/
prop_arg.go
36 lines (31 loc) · 947 Bytes
/
prop_arg.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
package gopter
import (
"fmt"
"strings"
)
// PropArg contains information about the specific values for a certain property check.
// This is mostly used for reporting when a property has falsified.
type PropArg struct {
Arg interface{}
ArgFormatted string
OrigArg interface{}
OrigArgFormatted string
Label string
Shrinks int
}
func (p *PropArg) String() string {
return fmt.Sprintf("%v", p.Arg)
}
// PropArgs is a list of PropArg.
type PropArgs []*PropArg
// NewPropArg creates a new PropArg.
func NewPropArg(genResult *GenResult, shrinks int, value interface{}, valueFormated string, origValue interface{}, origValueFormated string) *PropArg {
return &PropArg{
Label: strings.Join(genResult.Labels, ", "),
Arg: value,
ArgFormatted: valueFormated,
OrigArg: origValue,
OrigArgFormatted: origValueFormated,
Shrinks: shrinks,
}
}