(t *testing.T)
| 215 | } |
| 216 | |
| 217 | func TestVariableLengthArrays(t *testing.T) { |
| 218 | ctx := context.Background() |
| 219 | |
| 220 | tests := []struct { |
| 221 | name string |
| 222 | template string |
| 223 | data map[string]any |
| 224 | wantErr bool |
| 225 | }{ |
| 226 | // Signed integer tests |
| 227 | { |
| 228 | name: "int8 array with boundary values", |
| 229 | template: `{"arr": [11]}`, |
| 230 | data: map[string]any{"arr": []int8{-128, -64, 0, 64, 127}}, |
| 231 | }, |
| 232 | { |
| 233 | name: "int16 array with boundary values", |
| 234 | template: `{"arr": [12]}`, |
| 235 | data: map[string]any{"arr": []int16{-32768, -16384, 0, 16384, 32767}}, |
| 236 | }, |
| 237 | { |
| 238 | name: "int24 array with boundary values", |
| 239 | template: `{"arr": [13]}`, |
| 240 | data: map[string]any{"arr": []int32{-8388608, -4194304, 0, 4194304, 8388607}}, |
| 241 | }, |
| 242 | { |
| 243 | name: "int32 array with boundary values", |
| 244 | template: `{"arr": [14]}`, |
| 245 | data: map[string]any{"arr": []int32{-2147483648, -1073741824, 0, 1073741824, 2147483647}}, |
| 246 | }, |
| 247 | { |
| 248 | name: "int40 array with boundary values", |
| 249 | template: `{"arr": [15]}`, |
| 250 | data: map[string]any{"arr": []int64{-549755813888, -274877906944, 0, 274877906944, 549755813887}}, |
| 251 | }, |
| 252 | { |
| 253 | name: "int48 array with boundary values", |
| 254 | template: `{"arr": [16]}`, |
| 255 | data: map[string]any{"arr": []int64{-140737488355328, -70368744177664, 0, 70368744177664, 140737488355327}}, |
| 256 | }, |
| 257 | { |
| 258 | name: "int56 array with boundary values", |
| 259 | template: `{"arr": [17]}`, |
| 260 | data: map[string]any{"arr": []int64{-36028797018963968, -18014398509481984, 0, 18014398509481984, 36028797018963967}}, |
| 261 | }, |
| 262 | { |
| 263 | name: "int64 array with boundary values", |
| 264 | template: `{"arr": [18]}`, |
| 265 | data: map[string]any{"arr": []int64{-9223372036854775808, -4611686018427387904, 0, 4611686018427387904, 9223372036854775807}}, |
| 266 | }, |
| 267 | // Unsigned integer tests |
| 268 | /*{ // DAH this test fails because MarshalJson converts an array of uint8 to character array: "Array and slice values encode as JSON arrays, except that []byte encodes as a base64-encoded string, and a nil slice encodes as the null JSON object." |
| 269 | name: "uint8 array with boundary values", |
| 270 | template: `{"arr": [21]}`, |
| 271 | data: map[string]any{"arr": []uint8{0, 64, 128, 192, 255}}, |
| 272 | },*/ |
| 273 | { |
| 274 | name: "uint16 array with boundary values", |
nothing calls this directly
no test coverage detected