Exemplo n.º 1
0
// ShouldBeLessThan receives exactly two parameters and ensures that the first is less than the second.
func ShouldBeLessThan(actual interface{}, expected ...interface{}) string {
	if fail := need(1, expected); fail != success {
		return fail
	} else if matchError := oglematchers.LessThan(expected[0]).Matches(actual); matchError != nil {
		return fmt.Sprintf(shouldHaveBeenLess, actual, expected[0])
	}
	return success
}
Exemplo n.º 2
0
// AssertLt(x, y) is equivalent to AssertThat(x, oglematchers.LessThan(y)).
func AssertLt(x, y interface{}, errorParts ...interface{}) ExpectationResult {
	res := ExpectThat(x, oglematchers.LessThan(y), errorParts...)
	res.SetCaller(getCallerForAlias())

	matcherErr := res.MatchResult()
	if matcherErr != nil {
		panic(&assertThatError{})
	}

	return res
}
Exemplo n.º 3
0
// ExpectLt(x, y) is equivalent to ExpectThat(x, oglematchers.LessThan(y)).
func ExpectLt(x, y interface{}, errorParts ...interface{}) {
	expectThat(x, oglematchers.LessThan(y), 1, errorParts)
}
Exemplo n.º 4
0
// ExpectLt(x, y) is equivalent to ExpectThat(x, oglematchers.LessThan(y)).
func ExpectLt(x, y interface{}, errorParts ...interface{}) ExpectationResult {
	res := ExpectThat(x, oglematchers.LessThan(y), errorParts...)
	res.SetCaller(getCallerForAlias())
	return res
}
Exemplo n.º 5
0
// AssertLt(x, y) is equivalent to AssertThat(x, oglematchers.LessThan(y)).
func AssertLt(x, y interface{}, errorParts ...interface{}) {
	assertThat(x, oglematchers.LessThan(y), 1, errorParts)
}