(t *testing.T)
| 147 | } |
| 148 | |
| 149 | func TestIsNonDecreasing(t *testing.T) { |
| 150 | t.Parallel() |
| 151 | |
| 152 | mockT := new(testing.T) |
| 153 | |
| 154 | if !IsNonDecreasing(mockT, []int{1, 2}) { |
| 155 | t.Error("IsNonDecreasing should return true") |
| 156 | } |
| 157 | |
| 158 | if !IsNonDecreasing(mockT, []int{1, 1, 2, 3, 4, 5}) { |
| 159 | t.Error("IsNonDecreasing should return true") |
| 160 | } |
| 161 | |
| 162 | if !IsNonDecreasing(mockT, []int{1, 1}) { |
| 163 | t.Error("IsNonDecreasing should return false") |
| 164 | } |
| 165 | |
| 166 | if IsNonDecreasing(mockT, []int{2, 1}) { |
| 167 | t.Error("IsNonDecreasing should return false") |
| 168 | } |
| 169 | |
| 170 | // Check error report |
| 171 | for _, currCase := range []struct { |
| 172 | collection interface{} |
| 173 | msg string |
| 174 | }{ |
| 175 | {collection: []string{"b", "a"}, msg: `"b" is not less than or equal to "a"`}, |
| 176 | {collection: []int{2, 1}, msg: `"2" is not less than or equal to "1"`}, |
| 177 | {collection: []int{2, 1, 3, 4, 5, 6, 7}, msg: `"2" is not less than or equal to "1"`}, |
| 178 | {collection: []int{-1, 0, 2, 1}, msg: `"2" is not less than or equal to "1"`}, |
| 179 | {collection: []int8{2, 1}, msg: `"2" is not less than or equal to "1"`}, |
| 180 | {collection: []int16{2, 1}, msg: `"2" is not less than or equal to "1"`}, |
| 181 | {collection: []int32{2, 1}, msg: `"2" is not less than or equal to "1"`}, |
| 182 | {collection: []int64{2, 1}, msg: `"2" is not less than or equal to "1"`}, |
| 183 | {collection: []uint8{2, 1}, msg: `"2" is not less than or equal to "1"`}, |
| 184 | {collection: []uint16{2, 1}, msg: `"2" is not less than or equal to "1"`}, |
| 185 | {collection: []uint32{2, 1}, msg: `"2" is not less than or equal to "1"`}, |
| 186 | {collection: []uint64{2, 1}, msg: `"2" is not less than or equal to "1"`}, |
| 187 | {collection: []float32{2.34, 1.23}, msg: `"2.34" is not less than or equal to "1.23"`}, |
| 188 | {collection: []float64{2.34, 1.23}, msg: `"2.34" is not less than or equal to "1.23"`}, |
| 189 | } { |
| 190 | out := &outputT{buf: bytes.NewBuffer(nil)} |
| 191 | False(t, IsNonDecreasing(out, currCase.collection)) |
| 192 | Contains(t, out.buf.String(), currCase.msg) |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | func TestOrderingMsgAndArgsForwarding(t *testing.T) { |
| 197 | t.Parallel() |
nothing calls this directly
no test coverage detected