github.com/leanovate/gopter@v0.2.9/prop_arg.go (about)

     1  package gopter
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  )
     7  
     8  // PropArg contains information about the specific values for a certain property check.
     9  // This is mostly used for reporting when a property has falsified.
    10  type PropArg struct {
    11  	Arg              interface{}
    12  	ArgFormatted     string
    13  	OrigArg          interface{}
    14  	OrigArgFormatted string
    15  	Label            string
    16  	Shrinks          int
    17  }
    18  
    19  func (p *PropArg) String() string {
    20  	return fmt.Sprintf("%v", p.Arg)
    21  }
    22  
    23  // PropArgs is a list of PropArg.
    24  type PropArgs []*PropArg
    25  
    26  // NewPropArg creates a new PropArg.
    27  func NewPropArg(genResult *GenResult, shrinks int, value interface{}, valueFormated string, origValue interface{}, origValueFormated string) *PropArg {
    28  	return &PropArg{
    29  		Label:            strings.Join(genResult.Labels, ", "),
    30  		Arg:              value,
    31  		ArgFormatted:     valueFormated,
    32  		OrigArg:          origValue,
    33  		OrigArgFormatted: origValueFormated,
    34  		Shrinks:          shrinks,
    35  	}
    36  }