| 1 |
package assert |
| 2 |
|
| 3 |
// Allowable numeric types of comparison parameters |
| 4 |
type Number interface { |
| 5 |
~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint8 | ~uint16 | ~uint32 | ~float32 | ~float64 | ~uint64 | ~uint | ~uintptr |
| 6 |
} |
| 7 |
|
| 8 |
// Internally, numeric guidanceFn Operands only use these |
| 9 |
type operandConstraint interface { |
| 10 |
int32 | int64 | uint64 | float64 |
| 11 |
} |
| 12 |
|
| 13 |
type numConstraint interface { |
| 14 |
uint64 | float64 |
| 15 |
} |
| 16 |
|
| 17 |
// Used for boolean assertions |
| 18 |
type NamedBool struct { |
| 19 |
First string `json:"first"` |
| 20 |
Second bool `json:"second"` |
| 21 |
} |
| 22 |
|
| 23 |
// Convenience function to construct a NamedBool used for boolean assertions |
| 24 |
func NewNamedBool(first string, second bool) *NamedBool { |
| 25 |
p := NamedBool{ |
| 26 |
First: first, |
| 27 |
Second: second, |
| 28 |
} |
| 29 |
return &p |
| 30 |
} |