48 // |
48 // |
49 // assert.IsIncreasing(t, []int{1, 2, 3}) |
49 // assert.IsIncreasing(t, []int{1, 2, 3}) |
50 // assert.IsIncreasing(t, []float{1, 2}) |
50 // assert.IsIncreasing(t, []float{1, 2}) |
51 // assert.IsIncreasing(t, []string{"a", "b"}) |
51 // assert.IsIncreasing(t, []string{"a", "b"}) |
52 func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { |
52 func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { |
53 return isOrdered(t, object, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs) |
53 return isOrdered(t, object, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) |
54 } |
54 } |
55 |
55 |
56 // IsNonIncreasing asserts that the collection is not increasing |
56 // IsNonIncreasing asserts that the collection is not increasing |
57 // |
57 // |
58 // assert.IsNonIncreasing(t, []int{2, 1, 1}) |
58 // assert.IsNonIncreasing(t, []int{2, 1, 1}) |
59 // assert.IsNonIncreasing(t, []float{2, 1}) |
59 // assert.IsNonIncreasing(t, []float{2, 1}) |
60 // assert.IsNonIncreasing(t, []string{"b", "a"}) |
60 // assert.IsNonIncreasing(t, []string{"b", "a"}) |
61 func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { |
61 func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { |
62 return isOrdered(t, object, []CompareType{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs) |
62 return isOrdered(t, object, []CompareType{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) |
63 } |
63 } |
64 |
64 |
65 // IsDecreasing asserts that the collection is decreasing |
65 // IsDecreasing asserts that the collection is decreasing |
66 // |
66 // |
67 // assert.IsDecreasing(t, []int{2, 1, 0}) |
67 // assert.IsDecreasing(t, []int{2, 1, 0}) |
68 // assert.IsDecreasing(t, []float{2, 1}) |
68 // assert.IsDecreasing(t, []float{2, 1}) |
69 // assert.IsDecreasing(t, []string{"b", "a"}) |
69 // assert.IsDecreasing(t, []string{"b", "a"}) |
70 func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { |
70 func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { |
71 return isOrdered(t, object, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs) |
71 return isOrdered(t, object, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) |
72 } |
72 } |
73 |
73 |
74 // IsNonDecreasing asserts that the collection is not decreasing |
74 // IsNonDecreasing asserts that the collection is not decreasing |
75 // |
75 // |
76 // assert.IsNonDecreasing(t, []int{1, 1, 2}) |
76 // assert.IsNonDecreasing(t, []int{1, 1, 2}) |
77 // assert.IsNonDecreasing(t, []float{1, 2}) |
77 // assert.IsNonDecreasing(t, []float{1, 2}) |
78 // assert.IsNonDecreasing(t, []string{"a", "b"}) |
78 // assert.IsNonDecreasing(t, []string{"a", "b"}) |
79 func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { |
79 func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { |
80 return isOrdered(t, object, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs) |
80 return isOrdered(t, object, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) |
81 } |
81 } |