|
| 1 | +package fp |
| 2 | + |
| 3 | +import ( |
| 4 | + _ "errors" |
| 5 | + "reflect" |
| 6 | + "testing" |
| 7 | +) |
| 8 | + |
| 9 | +func TestOddInt(t *testing.T) { |
| 10 | + r := OddInt(11) |
| 11 | + if !r { |
| 12 | + t.Errorf("OddInt failed. Expected=true, actual=false") |
| 13 | + t.Errorf(reflect.String.String()) |
| 14 | + } |
| 15 | + |
| 16 | + r = OddInt(2) |
| 17 | + if r { |
| 18 | + t.Errorf("OddInt failed. Expected=false, actual=true") |
| 19 | + } |
| 20 | + |
| 21 | + var three int = 3 |
| 22 | + rPtr := OddIntPtr(&three) |
| 23 | + if !rPtr { |
| 24 | + t.Errorf("OddIntPtr failed. Expected=true, actual=false") |
| 25 | + } |
| 26 | +} |
| 27 | + |
| 28 | +func TestOddInt64(t *testing.T) { |
| 29 | + r := OddInt64(11) |
| 30 | + if !r { |
| 31 | + t.Errorf("OddInt64 failed. Expected=true, actual=false") |
| 32 | + t.Errorf(reflect.String.String()) |
| 33 | + } |
| 34 | + |
| 35 | + r = OddInt64(2) |
| 36 | + if r { |
| 37 | + t.Errorf("OddInt64 failed. Expected=false, actual=true") |
| 38 | + } |
| 39 | + |
| 40 | + var three int64 = 3 |
| 41 | + rPtr := OddInt64Ptr(&three) |
| 42 | + if !rPtr { |
| 43 | + t.Errorf("OddInt64Ptr failed. Expected=true, actual=false") |
| 44 | + } |
| 45 | +} |
| 46 | + |
| 47 | +func TestOddInt32(t *testing.T) { |
| 48 | + r := OddInt32(11) |
| 49 | + if !r { |
| 50 | + t.Errorf("OddInt32 failed. Expected=true, actual=false") |
| 51 | + t.Errorf(reflect.String.String()) |
| 52 | + } |
| 53 | + |
| 54 | + r = OddInt32(2) |
| 55 | + if r { |
| 56 | + t.Errorf("OddInt32 failed. Expected=false, actual=true") |
| 57 | + } |
| 58 | + |
| 59 | + var three int32 = 3 |
| 60 | + rPtr := OddInt32Ptr(&three) |
| 61 | + if !rPtr { |
| 62 | + t.Errorf("OddInt32Ptr failed. Expected=true, actual=false") |
| 63 | + } |
| 64 | +} |
| 65 | + |
| 66 | +func TestOddInt16(t *testing.T) { |
| 67 | + r := OddInt16(11) |
| 68 | + if !r { |
| 69 | + t.Errorf("OddInt16 failed. Expected=true, actual=false") |
| 70 | + t.Errorf(reflect.String.String()) |
| 71 | + } |
| 72 | + |
| 73 | + r = OddInt16(2) |
| 74 | + if r { |
| 75 | + t.Errorf("OddInt16 failed. Expected=false, actual=true") |
| 76 | + } |
| 77 | + |
| 78 | + var three int16 = 3 |
| 79 | + rPtr := OddInt16Ptr(&three) |
| 80 | + if !rPtr { |
| 81 | + t.Errorf("OddInt16Ptr failed. Expected=true, actual=false") |
| 82 | + } |
| 83 | +} |
| 84 | + |
| 85 | +func TestOddInt8(t *testing.T) { |
| 86 | + r := OddInt8(11) |
| 87 | + if !r { |
| 88 | + t.Errorf("OddInt8 failed. Expected=true, actual=false") |
| 89 | + t.Errorf(reflect.String.String()) |
| 90 | + } |
| 91 | + |
| 92 | + r = OddInt8(2) |
| 93 | + if r { |
| 94 | + t.Errorf("OddInt8 failed. Expected=false, actual=true") |
| 95 | + } |
| 96 | + |
| 97 | + var three int8 = 3 |
| 98 | + rPtr := OddInt8Ptr(&three) |
| 99 | + if !rPtr { |
| 100 | + t.Errorf("OddInt8Ptr failed. Expected=true, actual=false") |
| 101 | + } |
| 102 | +} |
| 103 | + |
| 104 | +func TestOddUint(t *testing.T) { |
| 105 | + r := OddUint(11) |
| 106 | + if !r { |
| 107 | + t.Errorf("OddUint failed. Expected=true, actual=false") |
| 108 | + t.Errorf(reflect.String.String()) |
| 109 | + } |
| 110 | + |
| 111 | + r = OddUint(2) |
| 112 | + if r { |
| 113 | + t.Errorf("OddUint failed. Expected=false, actual=true") |
| 114 | + } |
| 115 | + |
| 116 | + var three uint = 3 |
| 117 | + rPtr := OddUintPtr(&three) |
| 118 | + if !rPtr { |
| 119 | + t.Errorf("OddUintPtr failed. Expected=true, actual=false") |
| 120 | + } |
| 121 | +} |
| 122 | + |
| 123 | +func TestOddUint64(t *testing.T) { |
| 124 | + r := OddUint64(11) |
| 125 | + if !r { |
| 126 | + t.Errorf("OddUint64 failed. Expected=true, actual=false") |
| 127 | + t.Errorf(reflect.String.String()) |
| 128 | + } |
| 129 | + |
| 130 | + r = OddUint64(2) |
| 131 | + if r { |
| 132 | + t.Errorf("OddUint64 failed. Expected=false, actual=true") |
| 133 | + } |
| 134 | + |
| 135 | + var three uint64 = 3 |
| 136 | + rPtr := OddUint64Ptr(&three) |
| 137 | + if !rPtr { |
| 138 | + t.Errorf("OddUint64Ptr failed. Expected=true, actual=false") |
| 139 | + } |
| 140 | +} |
| 141 | + |
| 142 | +func TestOddUint32(t *testing.T) { |
| 143 | + r := OddUint32(11) |
| 144 | + if !r { |
| 145 | + t.Errorf("OddUint32 failed. Expected=true, actual=false") |
| 146 | + t.Errorf(reflect.String.String()) |
| 147 | + } |
| 148 | + |
| 149 | + r = OddUint32(2) |
| 150 | + if r { |
| 151 | + t.Errorf("OddUint32 failed. Expected=false, actual=true") |
| 152 | + } |
| 153 | + |
| 154 | + var three uint32 = 3 |
| 155 | + rPtr := OddUint32Ptr(&three) |
| 156 | + if !rPtr { |
| 157 | + t.Errorf("OddUint32Ptr failed. Expected=true, actual=false") |
| 158 | + } |
| 159 | +} |
| 160 | + |
| 161 | +func TestOddUint16(t *testing.T) { |
| 162 | + r := OddUint16(11) |
| 163 | + if !r { |
| 164 | + t.Errorf("OddUint16 failed. Expected=true, actual=false") |
| 165 | + t.Errorf(reflect.String.String()) |
| 166 | + } |
| 167 | + |
| 168 | + r = OddUint16(2) |
| 169 | + if r { |
| 170 | + t.Errorf("OddUint16 failed. Expected=false, actual=true") |
| 171 | + } |
| 172 | + |
| 173 | + var three uint16 = 3 |
| 174 | + rPtr := OddUint16Ptr(&three) |
| 175 | + if !rPtr { |
| 176 | + t.Errorf("OddUint16Ptr failed. Expected=true, actual=false") |
| 177 | + } |
| 178 | +} |
| 179 | + |
| 180 | +func TestOddUint8(t *testing.T) { |
| 181 | + r := OddUint8(11) |
| 182 | + if !r { |
| 183 | + t.Errorf("OddUint8 failed. Expected=true, actual=false") |
| 184 | + t.Errorf(reflect.String.String()) |
| 185 | + } |
| 186 | + |
| 187 | + r = OddUint8(2) |
| 188 | + if r { |
| 189 | + t.Errorf("OddUint8 failed. Expected=false, actual=true") |
| 190 | + } |
| 191 | + |
| 192 | + var three uint8 = 3 |
| 193 | + rPtr := OddUint8Ptr(&three) |
| 194 | + if !rPtr { |
| 195 | + t.Errorf("OddUint8Ptr failed. Expected=true, actual=false") |
| 196 | + } |
| 197 | +} |
0 commit comments