(t *testing.T)
| 96 | } |
| 97 | |
| 98 | func TestIsDecreasing(t *testing.T) { |
| 99 | mockT := new(testing.T) |
| 100 | |
| 101 | if !IsDecreasing(mockT, []int{2, 1}) { |
| 102 | t.Error("IsDecreasing should return true") |
| 103 | } |
| 104 | |
| 105 | if !IsDecreasing(mockT, []int{5, 4, 3, 2, 1}) { |
| 106 | t.Error("IsDecreasing should return true") |
| 107 | } |
| 108 | |
| 109 | if IsDecreasing(mockT, []int{1, 1}) { |
| 110 | t.Error("IsDecreasing should return false") |
| 111 | } |
| 112 | |
| 113 | if IsDecreasing(mockT, []int{1, 2}) { |
| 114 | t.Error("IsDecreasing should return false") |
| 115 | } |
| 116 | |
| 117 | // Check error report |
| 118 | for _, currCase := range []struct { |
| 119 | collection interface{} |
| 120 | msg string |
| 121 | }{ |
| 122 | {collection: []string{"a", "b"}, msg: `"a" is not greater than "b"`}, |
| 123 | {collection: []int{1, 2}, msg: `"1" is not greater than "2"`}, |
| 124 | {collection: []int{1, 2, 7, 6, 5, 4, 3}, msg: `"1" is not greater than "2"`}, |
| 125 | {collection: []int{5, 4, 3, 1, 2}, msg: `"1" is not greater than "2"`}, |
| 126 | {collection: []int8{1, 2}, msg: `"1" is not greater than "2"`}, |
| 127 | {collection: []int16{1, 2}, msg: `"1" is not greater than "2"`}, |
| 128 | {collection: []int32{1, 2}, msg: `"1" is not greater than "2"`}, |
| 129 | {collection: []int64{1, 2}, msg: `"1" is not greater than "2"`}, |
| 130 | {collection: []uint8{1, 2}, msg: `"1" is not greater than "2"`}, |
| 131 | {collection: []uint16{1, 2}, msg: `"1" is not greater than "2"`}, |
| 132 | {collection: []uint32{1, 2}, msg: `"1" is not greater than "2"`}, |
| 133 | {collection: []uint64{1, 2}, msg: `"1" is not greater than "2"`}, |
| 134 | {collection: []float32{1.23, 2.34}, msg: `"1.23" is not greater than "2.34"`}, |
| 135 | {collection: []float64{1.23, 2.34}, msg: `"1.23" is not greater than "2.34"`}, |
| 136 | } { |
| 137 | out := &outputT{buf: bytes.NewBuffer(nil)} |
| 138 | False(t, IsDecreasing(out, currCase.collection)) |
| 139 | Contains(t, out.buf.String(), currCase.msg) |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | func TestIsNonDecreasing(t *testing.T) { |
| 144 | mockT := new(testing.T) |
nothing calls this directly
no test coverage detected
searching dependent graphs…