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