You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
576 B
24 lines
576 B
package assertions
|
|
|
|
import "fmt"
|
|
|
|
const (
|
|
success = ""
|
|
needExactValues = "This assertion requires exactly %d comparison values (you provided %d)."
|
|
needNonEmptyCollection = "This assertion requires at least 1 comparison value (you provided 0)."
|
|
)
|
|
|
|
func need(needed int, expected []interface{}) string {
|
|
if len(expected) != needed {
|
|
return fmt.Sprintf(needExactValues, needed, len(expected))
|
|
}
|
|
return success
|
|
}
|
|
|
|
func atLeast(minimum int, expected []interface{}) string {
|
|
if len(expected) < 1 {
|
|
return needNonEmptyCollection
|
|
}
|
|
return success
|
|
}
|