github.com/patricebensoussan/go/codec@v1.2.99/mammoth_generated_test.go (about) 1 // Copyright (c) 2012-2020 Ugorji Nwoke. All rights reserved. 2 // Use of this source code is governed by a MIT license found in the LICENSE file. 3 4 //go:build !codec.notmammoth 5 // +build !codec.notmammoth 6 7 // Code generated from mammoth-test.go.tmpl - DO NOT EDIT. 8 9 package codec 10 11 import "testing" 12 import "fmt" 13 import "reflect" 14 15 // TestMammoth has all the different paths optimized in fast-path 16 // It has all the primitives, slices and maps. 17 // 18 // For each of those types, it has a pointer and a non-pointer field. 19 20 func init() { _ = fmt.Printf } // so we can include fmt as needed 21 22 type TestMammoth struct { 23 FIntf interface{} 24 FptrIntf *interface{} 25 FString string 26 FptrString *string 27 FBytes []byte 28 FptrBytes *[]byte 29 FFloat32 float32 30 FptrFloat32 *float32 31 FFloat64 float64 32 FptrFloat64 *float64 33 FUint uint 34 FptrUint *uint 35 FUint8 uint8 36 FptrUint8 *uint8 37 FUint16 uint16 38 FptrUint16 *uint16 39 FUint32 uint32 40 FptrUint32 *uint32 41 FUint64 uint64 42 FptrUint64 *uint64 43 FUintptr uintptr 44 FptrUintptr *uintptr 45 FInt int 46 FptrInt *int 47 FInt8 int8 48 FptrInt8 *int8 49 FInt16 int16 50 FptrInt16 *int16 51 FInt32 int32 52 FptrInt32 *int32 53 FInt64 int64 54 FptrInt64 *int64 55 FBool bool 56 FptrBool *bool 57 58 FSliceIntf []interface{} 59 FptrSliceIntf *[]interface{} 60 Farr4SliceIntf [4]interface{} 61 FSliceString []string 62 FptrSliceString *[]string 63 Farr4SliceString [4]string 64 FSliceBytes [][]byte 65 FptrSliceBytes *[][]byte 66 Farr4SliceBytes [4][]byte 67 FSliceFloat32 []float32 68 FptrSliceFloat32 *[]float32 69 Farr4SliceFloat32 [4]float32 70 FSliceFloat64 []float64 71 FptrSliceFloat64 *[]float64 72 Farr4SliceFloat64 [4]float64 73 FSliceUint8 []uint8 74 FptrSliceUint8 *[]uint8 75 Farr4SliceUint8 [4]uint8 76 FSliceUint64 []uint64 77 FptrSliceUint64 *[]uint64 78 Farr4SliceUint64 [4]uint64 79 FSliceInt []int 80 FptrSliceInt *[]int 81 Farr4SliceInt [4]int 82 FSliceInt32 []int32 83 FptrSliceInt32 *[]int32 84 Farr4SliceInt32 [4]int32 85 FSliceInt64 []int64 86 FptrSliceInt64 *[]int64 87 Farr4SliceInt64 [4]int64 88 FSliceBool []bool 89 FptrSliceBool *[]bool 90 Farr4SliceBool [4]bool 91 92 FMapStringIntf map[string]interface{} 93 FptrMapStringIntf *map[string]interface{} 94 FMapStringString map[string]string 95 FptrMapStringString *map[string]string 96 FMapStringBytes map[string][]byte 97 FptrMapStringBytes *map[string][]byte 98 FMapStringUint8 map[string]uint8 99 FptrMapStringUint8 *map[string]uint8 100 FMapStringUint64 map[string]uint64 101 FptrMapStringUint64 *map[string]uint64 102 FMapStringInt map[string]int 103 FptrMapStringInt *map[string]int 104 FMapStringInt32 map[string]int32 105 FptrMapStringInt32 *map[string]int32 106 FMapStringFloat64 map[string]float64 107 FptrMapStringFloat64 *map[string]float64 108 FMapStringBool map[string]bool 109 FptrMapStringBool *map[string]bool 110 FMapUint8Intf map[uint8]interface{} 111 FptrMapUint8Intf *map[uint8]interface{} 112 FMapUint8String map[uint8]string 113 FptrMapUint8String *map[uint8]string 114 FMapUint8Bytes map[uint8][]byte 115 FptrMapUint8Bytes *map[uint8][]byte 116 FMapUint8Uint8 map[uint8]uint8 117 FptrMapUint8Uint8 *map[uint8]uint8 118 FMapUint8Uint64 map[uint8]uint64 119 FptrMapUint8Uint64 *map[uint8]uint64 120 FMapUint8Int map[uint8]int 121 FptrMapUint8Int *map[uint8]int 122 FMapUint8Int32 map[uint8]int32 123 FptrMapUint8Int32 *map[uint8]int32 124 FMapUint8Float64 map[uint8]float64 125 FptrMapUint8Float64 *map[uint8]float64 126 FMapUint8Bool map[uint8]bool 127 FptrMapUint8Bool *map[uint8]bool 128 FMapUint64Intf map[uint64]interface{} 129 FptrMapUint64Intf *map[uint64]interface{} 130 FMapUint64String map[uint64]string 131 FptrMapUint64String *map[uint64]string 132 FMapUint64Bytes map[uint64][]byte 133 FptrMapUint64Bytes *map[uint64][]byte 134 FMapUint64Uint8 map[uint64]uint8 135 FptrMapUint64Uint8 *map[uint64]uint8 136 FMapUint64Uint64 map[uint64]uint64 137 FptrMapUint64Uint64 *map[uint64]uint64 138 FMapUint64Int map[uint64]int 139 FptrMapUint64Int *map[uint64]int 140 FMapUint64Int32 map[uint64]int32 141 FptrMapUint64Int32 *map[uint64]int32 142 FMapUint64Float64 map[uint64]float64 143 FptrMapUint64Float64 *map[uint64]float64 144 FMapUint64Bool map[uint64]bool 145 FptrMapUint64Bool *map[uint64]bool 146 FMapIntIntf map[int]interface{} 147 FptrMapIntIntf *map[int]interface{} 148 FMapIntString map[int]string 149 FptrMapIntString *map[int]string 150 FMapIntBytes map[int][]byte 151 FptrMapIntBytes *map[int][]byte 152 FMapIntUint8 map[int]uint8 153 FptrMapIntUint8 *map[int]uint8 154 FMapIntUint64 map[int]uint64 155 FptrMapIntUint64 *map[int]uint64 156 FMapIntInt map[int]int 157 FptrMapIntInt *map[int]int 158 FMapIntInt32 map[int]int32 159 FptrMapIntInt32 *map[int]int32 160 FMapIntFloat64 map[int]float64 161 FptrMapIntFloat64 *map[int]float64 162 FMapIntBool map[int]bool 163 FptrMapIntBool *map[int]bool 164 FMapInt32Intf map[int32]interface{} 165 FptrMapInt32Intf *map[int32]interface{} 166 FMapInt32String map[int32]string 167 FptrMapInt32String *map[int32]string 168 FMapInt32Bytes map[int32][]byte 169 FptrMapInt32Bytes *map[int32][]byte 170 FMapInt32Uint8 map[int32]uint8 171 FptrMapInt32Uint8 *map[int32]uint8 172 FMapInt32Uint64 map[int32]uint64 173 FptrMapInt32Uint64 *map[int32]uint64 174 FMapInt32Int map[int32]int 175 FptrMapInt32Int *map[int32]int 176 FMapInt32Int32 map[int32]int32 177 FptrMapInt32Int32 *map[int32]int32 178 FMapInt32Float64 map[int32]float64 179 FptrMapInt32Float64 *map[int32]float64 180 FMapInt32Bool map[int32]bool 181 FptrMapInt32Bool *map[int32]bool 182 } 183 184 type typMbsSliceIntf []interface{} 185 186 func (_ typMbsSliceIntf) MapBySlice() {} 187 188 type typMbsSliceString []string 189 190 func (_ typMbsSliceString) MapBySlice() {} 191 192 type typMbsSliceBytes [][]byte 193 194 func (_ typMbsSliceBytes) MapBySlice() {} 195 196 type typMbsSliceFloat32 []float32 197 198 func (_ typMbsSliceFloat32) MapBySlice() {} 199 200 type typMbsSliceFloat64 []float64 201 202 func (_ typMbsSliceFloat64) MapBySlice() {} 203 204 type typMbsSliceUint8 []uint8 205 206 func (_ typMbsSliceUint8) MapBySlice() {} 207 208 type typMbsSliceUint64 []uint64 209 210 func (_ typMbsSliceUint64) MapBySlice() {} 211 212 type typMbsSliceInt []int 213 214 func (_ typMbsSliceInt) MapBySlice() {} 215 216 type typMbsSliceInt32 []int32 217 218 func (_ typMbsSliceInt32) MapBySlice() {} 219 220 type typMbsSliceInt64 []int64 221 222 func (_ typMbsSliceInt64) MapBySlice() {} 223 224 type typMbsSliceBool []bool 225 226 func (_ typMbsSliceBool) MapBySlice() {} 227 228 type typMapMapStringIntf map[string]interface{} 229 type typMapMapStringString map[string]string 230 type typMapMapStringBytes map[string][]byte 231 type typMapMapStringUint8 map[string]uint8 232 type typMapMapStringUint64 map[string]uint64 233 type typMapMapStringInt map[string]int 234 type typMapMapStringInt32 map[string]int32 235 type typMapMapStringFloat64 map[string]float64 236 type typMapMapStringBool map[string]bool 237 type typMapMapUint8Intf map[uint8]interface{} 238 type typMapMapUint8String map[uint8]string 239 type typMapMapUint8Bytes map[uint8][]byte 240 type typMapMapUint8Uint8 map[uint8]uint8 241 type typMapMapUint8Uint64 map[uint8]uint64 242 type typMapMapUint8Int map[uint8]int 243 type typMapMapUint8Int32 map[uint8]int32 244 type typMapMapUint8Float64 map[uint8]float64 245 type typMapMapUint8Bool map[uint8]bool 246 type typMapMapUint64Intf map[uint64]interface{} 247 type typMapMapUint64String map[uint64]string 248 type typMapMapUint64Bytes map[uint64][]byte 249 type typMapMapUint64Uint8 map[uint64]uint8 250 type typMapMapUint64Uint64 map[uint64]uint64 251 type typMapMapUint64Int map[uint64]int 252 type typMapMapUint64Int32 map[uint64]int32 253 type typMapMapUint64Float64 map[uint64]float64 254 type typMapMapUint64Bool map[uint64]bool 255 type typMapMapIntIntf map[int]interface{} 256 type typMapMapIntString map[int]string 257 type typMapMapIntBytes map[int][]byte 258 type typMapMapIntUint8 map[int]uint8 259 type typMapMapIntUint64 map[int]uint64 260 type typMapMapIntInt map[int]int 261 type typMapMapIntInt32 map[int]int32 262 type typMapMapIntFloat64 map[int]float64 263 type typMapMapIntBool map[int]bool 264 type typMapMapInt32Intf map[int32]interface{} 265 type typMapMapInt32String map[int32]string 266 type typMapMapInt32Bytes map[int32][]byte 267 type typMapMapInt32Uint8 map[int32]uint8 268 type typMapMapInt32Uint64 map[int32]uint64 269 type typMapMapInt32Int map[int32]int 270 type typMapMapInt32Int32 map[int32]int32 271 type typMapMapInt32Float64 map[int32]float64 272 type typMapMapInt32Bool map[int32]bool 273 274 func __doTestMammothSlices(t *testing.T, h Handle) { 275 var v17va [8]interface{} 276 for _, v := range [][]interface{}{nil, {}, {"string-is-an-interface-2", nil, nil, "string-is-an-interface-3"}} { 277 var v17v1, v17v2 []interface{} 278 var bs17 []byte 279 v17v1 = v 280 bs17 = testMarshalErr(v17v1, h, t, "enc-slice-v17") 281 if v == nil { 282 v17v2 = make([]interface{}, 2) 283 testUnmarshalErr(v17v2, bs17, h, t, "dec-slice-v17") 284 testDeepEqualErr(v17v2[0], v17v2[1], t, "equal-slice-v17") // should not change 285 testDeepEqualErr(len(v17v2), 2, t, "equal-slice-v17") // should not change 286 v17v2 = make([]interface{}, 2) 287 testUnmarshalErr(reflect.ValueOf(v17v2), bs17, h, t, "dec-slice-v17-noaddr") // non-addressable value 288 testDeepEqualErr(v17v2[0], v17v2[1], t, "equal-slice-v17-noaddr") // should not change 289 testDeepEqualErr(len(v17v2), 2, t, "equal-slice-v17") // should not change 290 } else { 291 v17v2 = make([]interface{}, len(v)) 292 testUnmarshalErr(v17v2, bs17, h, t, "dec-slice-v17") 293 testDeepEqualErr(v17v1, v17v2, t, "equal-slice-v17") 294 v17v2 = make([]interface{}, len(v)) 295 testUnmarshalErr(reflect.ValueOf(v17v2), bs17, h, t, "dec-slice-v17-noaddr") // non-addressable value 296 testDeepEqualErr(v17v1, v17v2, t, "equal-slice-v17-noaddr") 297 } 298 testReleaseBytes(bs17) 299 // ... 300 bs17 = testMarshalErr(&v17v1, h, t, "enc-slice-v17-p") 301 v17v2 = nil 302 testUnmarshalErr(&v17v2, bs17, h, t, "dec-slice-v17-p") 303 testDeepEqualErr(v17v1, v17v2, t, "equal-slice-v17-p") 304 v17va = [8]interface{}{} // clear the array 305 testUnmarshalErr(&v17va, bs17, h, t, "dec-array-v17-p-1") 306 if v17v1 == nil && v17v2 == nil { 307 v17v2 = []interface{}{} 308 } // so we can compare to zero len slice below 309 testDeepEqualErr(v17va[:len(v17v2)], v17v2, t, "equal-array-v17-p-1") 310 v17va = [8]interface{}{} // clear the array 311 v17v2 = v17va[:1:1] 312 testUnmarshalErr(&v17v2, bs17, h, t, "dec-slice-v17-p-1") 313 testDeepEqualErr(v17v1, v17v2, t, "equal-slice-v17-p-1") 314 v17va = [8]interface{}{} // clear the array 315 v17v2 = v17va[:len(v17v1):len(v17v1)] 316 testUnmarshalErr(&v17v2, bs17, h, t, "dec-slice-v17-p-len") 317 testDeepEqualErr(v17v1, v17v2, t, "equal-slice-v17-p-len") 318 v17va = [8]interface{}{} // clear the array 319 v17v2 = v17va[:] 320 testUnmarshalErr(&v17v2, bs17, h, t, "dec-slice-v17-p-cap") 321 testDeepEqualErr(v17v1, v17v2, t, "equal-slice-v17-p-cap") 322 if len(v17v1) > 1 { 323 v17va = [8]interface{}{} // clear the array 324 testUnmarshalErr((&v17va)[:len(v17v1)], bs17, h, t, "dec-slice-v17-p-len-noaddr") 325 testDeepEqualErr(v17v1, v17va[:len(v17v1)], t, "equal-slice-v17-p-len-noaddr") 326 v17va = [8]interface{}{} // clear the array 327 testUnmarshalErr((&v17va)[:], bs17, h, t, "dec-slice-v17-p-cap-noaddr") 328 testDeepEqualErr(v17v1, v17va[:len(v17v1)], t, "equal-slice-v17-p-cap-noaddr") 329 } 330 testReleaseBytes(bs17) 331 // ... 332 var v17v3, v17v4 typMbsSliceIntf 333 v17v2 = nil 334 if v != nil { 335 v17v2 = make([]interface{}, len(v)) 336 } 337 v17v3 = typMbsSliceIntf(v17v1) 338 v17v4 = typMbsSliceIntf(v17v2) 339 if v != nil { 340 bs17 = testMarshalErr(v17v3, h, t, "enc-slice-v17-custom") 341 testUnmarshalErr(v17v4, bs17, h, t, "dec-slice-v17-custom") 342 testDeepEqualErr(v17v3, v17v4, t, "equal-slice-v17-custom") 343 testReleaseBytes(bs17) 344 } 345 bs17 = testMarshalErr(&v17v3, h, t, "enc-slice-v17-custom-p") 346 v17v2 = nil 347 v17v4 = typMbsSliceIntf(v17v2) 348 testUnmarshalErr(&v17v4, bs17, h, t, "dec-slice-v17-custom-p") 349 testDeepEqualErr(v17v3, v17v4, t, "equal-slice-v17-custom-p") 350 testReleaseBytes(bs17) 351 } 352 var v18va [8]string 353 for _, v := range [][]string{nil, {}, {"some-string-2", "", "", "some-string-3"}} { 354 var v18v1, v18v2 []string 355 var bs18 []byte 356 v18v1 = v 357 bs18 = testMarshalErr(v18v1, h, t, "enc-slice-v18") 358 if v == nil { 359 v18v2 = make([]string, 2) 360 testUnmarshalErr(v18v2, bs18, h, t, "dec-slice-v18") 361 testDeepEqualErr(v18v2[0], v18v2[1], t, "equal-slice-v18") // should not change 362 testDeepEqualErr(len(v18v2), 2, t, "equal-slice-v18") // should not change 363 v18v2 = make([]string, 2) 364 testUnmarshalErr(reflect.ValueOf(v18v2), bs18, h, t, "dec-slice-v18-noaddr") // non-addressable value 365 testDeepEqualErr(v18v2[0], v18v2[1], t, "equal-slice-v18-noaddr") // should not change 366 testDeepEqualErr(len(v18v2), 2, t, "equal-slice-v18") // should not change 367 } else { 368 v18v2 = make([]string, len(v)) 369 testUnmarshalErr(v18v2, bs18, h, t, "dec-slice-v18") 370 testDeepEqualErr(v18v1, v18v2, t, "equal-slice-v18") 371 v18v2 = make([]string, len(v)) 372 testUnmarshalErr(reflect.ValueOf(v18v2), bs18, h, t, "dec-slice-v18-noaddr") // non-addressable value 373 testDeepEqualErr(v18v1, v18v2, t, "equal-slice-v18-noaddr") 374 } 375 testReleaseBytes(bs18) 376 // ... 377 bs18 = testMarshalErr(&v18v1, h, t, "enc-slice-v18-p") 378 v18v2 = nil 379 testUnmarshalErr(&v18v2, bs18, h, t, "dec-slice-v18-p") 380 testDeepEqualErr(v18v1, v18v2, t, "equal-slice-v18-p") 381 v18va = [8]string{} // clear the array 382 testUnmarshalErr(&v18va, bs18, h, t, "dec-array-v18-p-1") 383 if v18v1 == nil && v18v2 == nil { 384 v18v2 = []string{} 385 } // so we can compare to zero len slice below 386 testDeepEqualErr(v18va[:len(v18v2)], v18v2, t, "equal-array-v18-p-1") 387 v18va = [8]string{} // clear the array 388 v18v2 = v18va[:1:1] 389 testUnmarshalErr(&v18v2, bs18, h, t, "dec-slice-v18-p-1") 390 testDeepEqualErr(v18v1, v18v2, t, "equal-slice-v18-p-1") 391 v18va = [8]string{} // clear the array 392 v18v2 = v18va[:len(v18v1):len(v18v1)] 393 testUnmarshalErr(&v18v2, bs18, h, t, "dec-slice-v18-p-len") 394 testDeepEqualErr(v18v1, v18v2, t, "equal-slice-v18-p-len") 395 v18va = [8]string{} // clear the array 396 v18v2 = v18va[:] 397 testUnmarshalErr(&v18v2, bs18, h, t, "dec-slice-v18-p-cap") 398 testDeepEqualErr(v18v1, v18v2, t, "equal-slice-v18-p-cap") 399 if len(v18v1) > 1 { 400 v18va = [8]string{} // clear the array 401 testUnmarshalErr((&v18va)[:len(v18v1)], bs18, h, t, "dec-slice-v18-p-len-noaddr") 402 testDeepEqualErr(v18v1, v18va[:len(v18v1)], t, "equal-slice-v18-p-len-noaddr") 403 v18va = [8]string{} // clear the array 404 testUnmarshalErr((&v18va)[:], bs18, h, t, "dec-slice-v18-p-cap-noaddr") 405 testDeepEqualErr(v18v1, v18va[:len(v18v1)], t, "equal-slice-v18-p-cap-noaddr") 406 } 407 testReleaseBytes(bs18) 408 // ... 409 var v18v3, v18v4 typMbsSliceString 410 v18v2 = nil 411 if v != nil { 412 v18v2 = make([]string, len(v)) 413 } 414 v18v3 = typMbsSliceString(v18v1) 415 v18v4 = typMbsSliceString(v18v2) 416 if v != nil { 417 bs18 = testMarshalErr(v18v3, h, t, "enc-slice-v18-custom") 418 testUnmarshalErr(v18v4, bs18, h, t, "dec-slice-v18-custom") 419 testDeepEqualErr(v18v3, v18v4, t, "equal-slice-v18-custom") 420 testReleaseBytes(bs18) 421 } 422 bs18 = testMarshalErr(&v18v3, h, t, "enc-slice-v18-custom-p") 423 v18v2 = nil 424 v18v4 = typMbsSliceString(v18v2) 425 testUnmarshalErr(&v18v4, bs18, h, t, "dec-slice-v18-custom-p") 426 testDeepEqualErr(v18v3, v18v4, t, "equal-slice-v18-custom-p") 427 testReleaseBytes(bs18) 428 } 429 var v19va [8][]byte 430 for _, v := range [][][]byte{nil, {}, {[]byte("some-string-2"), nil, nil, []byte("some-string-3")}} { 431 var v19v1, v19v2 [][]byte 432 var bs19 []byte 433 v19v1 = v 434 bs19 = testMarshalErr(v19v1, h, t, "enc-slice-v19") 435 if v == nil { 436 v19v2 = make([][]byte, 2) 437 testUnmarshalErr(v19v2, bs19, h, t, "dec-slice-v19") 438 testDeepEqualErr(v19v2[0], v19v2[1], t, "equal-slice-v19") // should not change 439 testDeepEqualErr(len(v19v2), 2, t, "equal-slice-v19") // should not change 440 v19v2 = make([][]byte, 2) 441 testUnmarshalErr(reflect.ValueOf(v19v2), bs19, h, t, "dec-slice-v19-noaddr") // non-addressable value 442 testDeepEqualErr(v19v2[0], v19v2[1], t, "equal-slice-v19-noaddr") // should not change 443 testDeepEqualErr(len(v19v2), 2, t, "equal-slice-v19") // should not change 444 } else { 445 v19v2 = make([][]byte, len(v)) 446 testUnmarshalErr(v19v2, bs19, h, t, "dec-slice-v19") 447 testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19") 448 v19v2 = make([][]byte, len(v)) 449 testUnmarshalErr(reflect.ValueOf(v19v2), bs19, h, t, "dec-slice-v19-noaddr") // non-addressable value 450 testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-noaddr") 451 } 452 testReleaseBytes(bs19) 453 // ... 454 bs19 = testMarshalErr(&v19v1, h, t, "enc-slice-v19-p") 455 v19v2 = nil 456 testUnmarshalErr(&v19v2, bs19, h, t, "dec-slice-v19-p") 457 testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-p") 458 v19va = [8][]byte{} // clear the array 459 testUnmarshalErr(&v19va, bs19, h, t, "dec-array-v19-p-1") 460 if v19v1 == nil && v19v2 == nil { 461 v19v2 = [][]byte{} 462 } // so we can compare to zero len slice below 463 testDeepEqualErr(v19va[:len(v19v2)], v19v2, t, "equal-array-v19-p-1") 464 v19va = [8][]byte{} // clear the array 465 v19v2 = v19va[:1:1] 466 testUnmarshalErr(&v19v2, bs19, h, t, "dec-slice-v19-p-1") 467 testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-p-1") 468 v19va = [8][]byte{} // clear the array 469 v19v2 = v19va[:len(v19v1):len(v19v1)] 470 testUnmarshalErr(&v19v2, bs19, h, t, "dec-slice-v19-p-len") 471 testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-p-len") 472 v19va = [8][]byte{} // clear the array 473 v19v2 = v19va[:] 474 testUnmarshalErr(&v19v2, bs19, h, t, "dec-slice-v19-p-cap") 475 testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-p-cap") 476 if len(v19v1) > 1 { 477 v19va = [8][]byte{} // clear the array 478 testUnmarshalErr((&v19va)[:len(v19v1)], bs19, h, t, "dec-slice-v19-p-len-noaddr") 479 testDeepEqualErr(v19v1, v19va[:len(v19v1)], t, "equal-slice-v19-p-len-noaddr") 480 v19va = [8][]byte{} // clear the array 481 testUnmarshalErr((&v19va)[:], bs19, h, t, "dec-slice-v19-p-cap-noaddr") 482 testDeepEqualErr(v19v1, v19va[:len(v19v1)], t, "equal-slice-v19-p-cap-noaddr") 483 } 484 testReleaseBytes(bs19) 485 // ... 486 var v19v3, v19v4 typMbsSliceBytes 487 v19v2 = nil 488 if v != nil { 489 v19v2 = make([][]byte, len(v)) 490 } 491 v19v3 = typMbsSliceBytes(v19v1) 492 v19v4 = typMbsSliceBytes(v19v2) 493 if v != nil { 494 bs19 = testMarshalErr(v19v3, h, t, "enc-slice-v19-custom") 495 testUnmarshalErr(v19v4, bs19, h, t, "dec-slice-v19-custom") 496 testDeepEqualErr(v19v3, v19v4, t, "equal-slice-v19-custom") 497 testReleaseBytes(bs19) 498 } 499 bs19 = testMarshalErr(&v19v3, h, t, "enc-slice-v19-custom-p") 500 v19v2 = nil 501 v19v4 = typMbsSliceBytes(v19v2) 502 testUnmarshalErr(&v19v4, bs19, h, t, "dec-slice-v19-custom-p") 503 testDeepEqualErr(v19v3, v19v4, t, "equal-slice-v19-custom-p") 504 testReleaseBytes(bs19) 505 } 506 var v20va [8]float32 507 for _, v := range [][]float32{nil, {}, {22.2, 0, 0, 33.3e3}} { 508 var v20v1, v20v2 []float32 509 var bs20 []byte 510 v20v1 = v 511 bs20 = testMarshalErr(v20v1, h, t, "enc-slice-v20") 512 if v == nil { 513 v20v2 = make([]float32, 2) 514 testUnmarshalErr(v20v2, bs20, h, t, "dec-slice-v20") 515 testDeepEqualErr(v20v2[0], v20v2[1], t, "equal-slice-v20") // should not change 516 testDeepEqualErr(len(v20v2), 2, t, "equal-slice-v20") // should not change 517 v20v2 = make([]float32, 2) 518 testUnmarshalErr(reflect.ValueOf(v20v2), bs20, h, t, "dec-slice-v20-noaddr") // non-addressable value 519 testDeepEqualErr(v20v2[0], v20v2[1], t, "equal-slice-v20-noaddr") // should not change 520 testDeepEqualErr(len(v20v2), 2, t, "equal-slice-v20") // should not change 521 } else { 522 v20v2 = make([]float32, len(v)) 523 testUnmarshalErr(v20v2, bs20, h, t, "dec-slice-v20") 524 testDeepEqualErr(v20v1, v20v2, t, "equal-slice-v20") 525 v20v2 = make([]float32, len(v)) 526 testUnmarshalErr(reflect.ValueOf(v20v2), bs20, h, t, "dec-slice-v20-noaddr") // non-addressable value 527 testDeepEqualErr(v20v1, v20v2, t, "equal-slice-v20-noaddr") 528 } 529 testReleaseBytes(bs20) 530 // ... 531 bs20 = testMarshalErr(&v20v1, h, t, "enc-slice-v20-p") 532 v20v2 = nil 533 testUnmarshalErr(&v20v2, bs20, h, t, "dec-slice-v20-p") 534 testDeepEqualErr(v20v1, v20v2, t, "equal-slice-v20-p") 535 v20va = [8]float32{} // clear the array 536 testUnmarshalErr(&v20va, bs20, h, t, "dec-array-v20-p-1") 537 if v20v1 == nil && v20v2 == nil { 538 v20v2 = []float32{} 539 } // so we can compare to zero len slice below 540 testDeepEqualErr(v20va[:len(v20v2)], v20v2, t, "equal-array-v20-p-1") 541 v20va = [8]float32{} // clear the array 542 v20v2 = v20va[:1:1] 543 testUnmarshalErr(&v20v2, bs20, h, t, "dec-slice-v20-p-1") 544 testDeepEqualErr(v20v1, v20v2, t, "equal-slice-v20-p-1") 545 v20va = [8]float32{} // clear the array 546 v20v2 = v20va[:len(v20v1):len(v20v1)] 547 testUnmarshalErr(&v20v2, bs20, h, t, "dec-slice-v20-p-len") 548 testDeepEqualErr(v20v1, v20v2, t, "equal-slice-v20-p-len") 549 v20va = [8]float32{} // clear the array 550 v20v2 = v20va[:] 551 testUnmarshalErr(&v20v2, bs20, h, t, "dec-slice-v20-p-cap") 552 testDeepEqualErr(v20v1, v20v2, t, "equal-slice-v20-p-cap") 553 if len(v20v1) > 1 { 554 v20va = [8]float32{} // clear the array 555 testUnmarshalErr((&v20va)[:len(v20v1)], bs20, h, t, "dec-slice-v20-p-len-noaddr") 556 testDeepEqualErr(v20v1, v20va[:len(v20v1)], t, "equal-slice-v20-p-len-noaddr") 557 v20va = [8]float32{} // clear the array 558 testUnmarshalErr((&v20va)[:], bs20, h, t, "dec-slice-v20-p-cap-noaddr") 559 testDeepEqualErr(v20v1, v20va[:len(v20v1)], t, "equal-slice-v20-p-cap-noaddr") 560 } 561 testReleaseBytes(bs20) 562 // ... 563 var v20v3, v20v4 typMbsSliceFloat32 564 v20v2 = nil 565 if v != nil { 566 v20v2 = make([]float32, len(v)) 567 } 568 v20v3 = typMbsSliceFloat32(v20v1) 569 v20v4 = typMbsSliceFloat32(v20v2) 570 if v != nil { 571 bs20 = testMarshalErr(v20v3, h, t, "enc-slice-v20-custom") 572 testUnmarshalErr(v20v4, bs20, h, t, "dec-slice-v20-custom") 573 testDeepEqualErr(v20v3, v20v4, t, "equal-slice-v20-custom") 574 testReleaseBytes(bs20) 575 } 576 bs20 = testMarshalErr(&v20v3, h, t, "enc-slice-v20-custom-p") 577 v20v2 = nil 578 v20v4 = typMbsSliceFloat32(v20v2) 579 testUnmarshalErr(&v20v4, bs20, h, t, "dec-slice-v20-custom-p") 580 testDeepEqualErr(v20v3, v20v4, t, "equal-slice-v20-custom-p") 581 testReleaseBytes(bs20) 582 } 583 var v21va [8]float64 584 for _, v := range [][]float64{nil, {}, {11.1, 0, 0, 22.2}} { 585 var v21v1, v21v2 []float64 586 var bs21 []byte 587 v21v1 = v 588 bs21 = testMarshalErr(v21v1, h, t, "enc-slice-v21") 589 if v == nil { 590 v21v2 = make([]float64, 2) 591 testUnmarshalErr(v21v2, bs21, h, t, "dec-slice-v21") 592 testDeepEqualErr(v21v2[0], v21v2[1], t, "equal-slice-v21") // should not change 593 testDeepEqualErr(len(v21v2), 2, t, "equal-slice-v21") // should not change 594 v21v2 = make([]float64, 2) 595 testUnmarshalErr(reflect.ValueOf(v21v2), bs21, h, t, "dec-slice-v21-noaddr") // non-addressable value 596 testDeepEqualErr(v21v2[0], v21v2[1], t, "equal-slice-v21-noaddr") // should not change 597 testDeepEqualErr(len(v21v2), 2, t, "equal-slice-v21") // should not change 598 } else { 599 v21v2 = make([]float64, len(v)) 600 testUnmarshalErr(v21v2, bs21, h, t, "dec-slice-v21") 601 testDeepEqualErr(v21v1, v21v2, t, "equal-slice-v21") 602 v21v2 = make([]float64, len(v)) 603 testUnmarshalErr(reflect.ValueOf(v21v2), bs21, h, t, "dec-slice-v21-noaddr") // non-addressable value 604 testDeepEqualErr(v21v1, v21v2, t, "equal-slice-v21-noaddr") 605 } 606 testReleaseBytes(bs21) 607 // ... 608 bs21 = testMarshalErr(&v21v1, h, t, "enc-slice-v21-p") 609 v21v2 = nil 610 testUnmarshalErr(&v21v2, bs21, h, t, "dec-slice-v21-p") 611 testDeepEqualErr(v21v1, v21v2, t, "equal-slice-v21-p") 612 v21va = [8]float64{} // clear the array 613 testUnmarshalErr(&v21va, bs21, h, t, "dec-array-v21-p-1") 614 if v21v1 == nil && v21v2 == nil { 615 v21v2 = []float64{} 616 } // so we can compare to zero len slice below 617 testDeepEqualErr(v21va[:len(v21v2)], v21v2, t, "equal-array-v21-p-1") 618 v21va = [8]float64{} // clear the array 619 v21v2 = v21va[:1:1] 620 testUnmarshalErr(&v21v2, bs21, h, t, "dec-slice-v21-p-1") 621 testDeepEqualErr(v21v1, v21v2, t, "equal-slice-v21-p-1") 622 v21va = [8]float64{} // clear the array 623 v21v2 = v21va[:len(v21v1):len(v21v1)] 624 testUnmarshalErr(&v21v2, bs21, h, t, "dec-slice-v21-p-len") 625 testDeepEqualErr(v21v1, v21v2, t, "equal-slice-v21-p-len") 626 v21va = [8]float64{} // clear the array 627 v21v2 = v21va[:] 628 testUnmarshalErr(&v21v2, bs21, h, t, "dec-slice-v21-p-cap") 629 testDeepEqualErr(v21v1, v21v2, t, "equal-slice-v21-p-cap") 630 if len(v21v1) > 1 { 631 v21va = [8]float64{} // clear the array 632 testUnmarshalErr((&v21va)[:len(v21v1)], bs21, h, t, "dec-slice-v21-p-len-noaddr") 633 testDeepEqualErr(v21v1, v21va[:len(v21v1)], t, "equal-slice-v21-p-len-noaddr") 634 v21va = [8]float64{} // clear the array 635 testUnmarshalErr((&v21va)[:], bs21, h, t, "dec-slice-v21-p-cap-noaddr") 636 testDeepEqualErr(v21v1, v21va[:len(v21v1)], t, "equal-slice-v21-p-cap-noaddr") 637 } 638 testReleaseBytes(bs21) 639 // ... 640 var v21v3, v21v4 typMbsSliceFloat64 641 v21v2 = nil 642 if v != nil { 643 v21v2 = make([]float64, len(v)) 644 } 645 v21v3 = typMbsSliceFloat64(v21v1) 646 v21v4 = typMbsSliceFloat64(v21v2) 647 if v != nil { 648 bs21 = testMarshalErr(v21v3, h, t, "enc-slice-v21-custom") 649 testUnmarshalErr(v21v4, bs21, h, t, "dec-slice-v21-custom") 650 testDeepEqualErr(v21v3, v21v4, t, "equal-slice-v21-custom") 651 testReleaseBytes(bs21) 652 } 653 bs21 = testMarshalErr(&v21v3, h, t, "enc-slice-v21-custom-p") 654 v21v2 = nil 655 v21v4 = typMbsSliceFloat64(v21v2) 656 testUnmarshalErr(&v21v4, bs21, h, t, "dec-slice-v21-custom-p") 657 testDeepEqualErr(v21v3, v21v4, t, "equal-slice-v21-custom-p") 658 testReleaseBytes(bs21) 659 } 660 var v22va [8]uint8 661 for _, v := range [][]uint8{nil, {}, {77, 0, 0, 127}} { 662 var v22v1, v22v2 []uint8 663 var bs22 []byte 664 v22v1 = v 665 bs22 = testMarshalErr(v22v1, h, t, "enc-slice-v22") 666 if v == nil { 667 v22v2 = make([]uint8, 2) 668 testUnmarshalErr(v22v2, bs22, h, t, "dec-slice-v22") 669 testDeepEqualErr(v22v2[0], v22v2[1], t, "equal-slice-v22") // should not change 670 testDeepEqualErr(len(v22v2), 2, t, "equal-slice-v22") // should not change 671 v22v2 = make([]uint8, 2) 672 testUnmarshalErr(reflect.ValueOf(v22v2), bs22, h, t, "dec-slice-v22-noaddr") // non-addressable value 673 testDeepEqualErr(v22v2[0], v22v2[1], t, "equal-slice-v22-noaddr") // should not change 674 testDeepEqualErr(len(v22v2), 2, t, "equal-slice-v22") // should not change 675 } else { 676 v22v2 = make([]uint8, len(v)) 677 testUnmarshalErr(v22v2, bs22, h, t, "dec-slice-v22") 678 testDeepEqualErr(v22v1, v22v2, t, "equal-slice-v22") 679 v22v2 = make([]uint8, len(v)) 680 testUnmarshalErr(reflect.ValueOf(v22v2), bs22, h, t, "dec-slice-v22-noaddr") // non-addressable value 681 testDeepEqualErr(v22v1, v22v2, t, "equal-slice-v22-noaddr") 682 } 683 testReleaseBytes(bs22) 684 // ... 685 bs22 = testMarshalErr(&v22v1, h, t, "enc-slice-v22-p") 686 v22v2 = nil 687 testUnmarshalErr(&v22v2, bs22, h, t, "dec-slice-v22-p") 688 testDeepEqualErr(v22v1, v22v2, t, "equal-slice-v22-p") 689 v22va = [8]uint8{} // clear the array 690 testUnmarshalErr(&v22va, bs22, h, t, "dec-array-v22-p-1") 691 if v22v1 == nil && v22v2 == nil { 692 v22v2 = []uint8{} 693 } // so we can compare to zero len slice below 694 testDeepEqualErr(v22va[:len(v22v2)], v22v2, t, "equal-array-v22-p-1") 695 v22va = [8]uint8{} // clear the array 696 v22v2 = v22va[:1:1] 697 testUnmarshalErr(&v22v2, bs22, h, t, "dec-slice-v22-p-1") 698 testDeepEqualErr(v22v1, v22v2, t, "equal-slice-v22-p-1") 699 v22va = [8]uint8{} // clear the array 700 v22v2 = v22va[:len(v22v1):len(v22v1)] 701 testUnmarshalErr(&v22v2, bs22, h, t, "dec-slice-v22-p-len") 702 testDeepEqualErr(v22v1, v22v2, t, "equal-slice-v22-p-len") 703 v22va = [8]uint8{} // clear the array 704 v22v2 = v22va[:] 705 testUnmarshalErr(&v22v2, bs22, h, t, "dec-slice-v22-p-cap") 706 testDeepEqualErr(v22v1, v22v2, t, "equal-slice-v22-p-cap") 707 if len(v22v1) > 1 { 708 v22va = [8]uint8{} // clear the array 709 testUnmarshalErr((&v22va)[:len(v22v1)], bs22, h, t, "dec-slice-v22-p-len-noaddr") 710 testDeepEqualErr(v22v1, v22va[:len(v22v1)], t, "equal-slice-v22-p-len-noaddr") 711 v22va = [8]uint8{} // clear the array 712 testUnmarshalErr((&v22va)[:], bs22, h, t, "dec-slice-v22-p-cap-noaddr") 713 testDeepEqualErr(v22v1, v22va[:len(v22v1)], t, "equal-slice-v22-p-cap-noaddr") 714 } 715 testReleaseBytes(bs22) 716 // ... 717 var v22v3, v22v4 typMbsSliceUint8 718 v22v2 = nil 719 if v != nil { 720 v22v2 = make([]uint8, len(v)) 721 } 722 v22v3 = typMbsSliceUint8(v22v1) 723 v22v4 = typMbsSliceUint8(v22v2) 724 if v != nil { 725 bs22 = testMarshalErr(v22v3, h, t, "enc-slice-v22-custom") 726 testUnmarshalErr(v22v4, bs22, h, t, "dec-slice-v22-custom") 727 testDeepEqualErr(v22v3, v22v4, t, "equal-slice-v22-custom") 728 testReleaseBytes(bs22) 729 } 730 bs22 = testMarshalErr(&v22v3, h, t, "enc-slice-v22-custom-p") 731 v22v2 = nil 732 v22v4 = typMbsSliceUint8(v22v2) 733 testUnmarshalErr(&v22v4, bs22, h, t, "dec-slice-v22-custom-p") 734 testDeepEqualErr(v22v3, v22v4, t, "equal-slice-v22-custom-p") 735 testReleaseBytes(bs22) 736 } 737 var v23va [8]uint64 738 for _, v := range [][]uint64{nil, {}, {111, 0, 0, 77}} { 739 var v23v1, v23v2 []uint64 740 var bs23 []byte 741 v23v1 = v 742 bs23 = testMarshalErr(v23v1, h, t, "enc-slice-v23") 743 if v == nil { 744 v23v2 = make([]uint64, 2) 745 testUnmarshalErr(v23v2, bs23, h, t, "dec-slice-v23") 746 testDeepEqualErr(v23v2[0], v23v2[1], t, "equal-slice-v23") // should not change 747 testDeepEqualErr(len(v23v2), 2, t, "equal-slice-v23") // should not change 748 v23v2 = make([]uint64, 2) 749 testUnmarshalErr(reflect.ValueOf(v23v2), bs23, h, t, "dec-slice-v23-noaddr") // non-addressable value 750 testDeepEqualErr(v23v2[0], v23v2[1], t, "equal-slice-v23-noaddr") // should not change 751 testDeepEqualErr(len(v23v2), 2, t, "equal-slice-v23") // should not change 752 } else { 753 v23v2 = make([]uint64, len(v)) 754 testUnmarshalErr(v23v2, bs23, h, t, "dec-slice-v23") 755 testDeepEqualErr(v23v1, v23v2, t, "equal-slice-v23") 756 v23v2 = make([]uint64, len(v)) 757 testUnmarshalErr(reflect.ValueOf(v23v2), bs23, h, t, "dec-slice-v23-noaddr") // non-addressable value 758 testDeepEqualErr(v23v1, v23v2, t, "equal-slice-v23-noaddr") 759 } 760 testReleaseBytes(bs23) 761 // ... 762 bs23 = testMarshalErr(&v23v1, h, t, "enc-slice-v23-p") 763 v23v2 = nil 764 testUnmarshalErr(&v23v2, bs23, h, t, "dec-slice-v23-p") 765 testDeepEqualErr(v23v1, v23v2, t, "equal-slice-v23-p") 766 v23va = [8]uint64{} // clear the array 767 testUnmarshalErr(&v23va, bs23, h, t, "dec-array-v23-p-1") 768 if v23v1 == nil && v23v2 == nil { 769 v23v2 = []uint64{} 770 } // so we can compare to zero len slice below 771 testDeepEqualErr(v23va[:len(v23v2)], v23v2, t, "equal-array-v23-p-1") 772 v23va = [8]uint64{} // clear the array 773 v23v2 = v23va[:1:1] 774 testUnmarshalErr(&v23v2, bs23, h, t, "dec-slice-v23-p-1") 775 testDeepEqualErr(v23v1, v23v2, t, "equal-slice-v23-p-1") 776 v23va = [8]uint64{} // clear the array 777 v23v2 = v23va[:len(v23v1):len(v23v1)] 778 testUnmarshalErr(&v23v2, bs23, h, t, "dec-slice-v23-p-len") 779 testDeepEqualErr(v23v1, v23v2, t, "equal-slice-v23-p-len") 780 v23va = [8]uint64{} // clear the array 781 v23v2 = v23va[:] 782 testUnmarshalErr(&v23v2, bs23, h, t, "dec-slice-v23-p-cap") 783 testDeepEqualErr(v23v1, v23v2, t, "equal-slice-v23-p-cap") 784 if len(v23v1) > 1 { 785 v23va = [8]uint64{} // clear the array 786 testUnmarshalErr((&v23va)[:len(v23v1)], bs23, h, t, "dec-slice-v23-p-len-noaddr") 787 testDeepEqualErr(v23v1, v23va[:len(v23v1)], t, "equal-slice-v23-p-len-noaddr") 788 v23va = [8]uint64{} // clear the array 789 testUnmarshalErr((&v23va)[:], bs23, h, t, "dec-slice-v23-p-cap-noaddr") 790 testDeepEqualErr(v23v1, v23va[:len(v23v1)], t, "equal-slice-v23-p-cap-noaddr") 791 } 792 testReleaseBytes(bs23) 793 // ... 794 var v23v3, v23v4 typMbsSliceUint64 795 v23v2 = nil 796 if v != nil { 797 v23v2 = make([]uint64, len(v)) 798 } 799 v23v3 = typMbsSliceUint64(v23v1) 800 v23v4 = typMbsSliceUint64(v23v2) 801 if v != nil { 802 bs23 = testMarshalErr(v23v3, h, t, "enc-slice-v23-custom") 803 testUnmarshalErr(v23v4, bs23, h, t, "dec-slice-v23-custom") 804 testDeepEqualErr(v23v3, v23v4, t, "equal-slice-v23-custom") 805 testReleaseBytes(bs23) 806 } 807 bs23 = testMarshalErr(&v23v3, h, t, "enc-slice-v23-custom-p") 808 v23v2 = nil 809 v23v4 = typMbsSliceUint64(v23v2) 810 testUnmarshalErr(&v23v4, bs23, h, t, "dec-slice-v23-custom-p") 811 testDeepEqualErr(v23v3, v23v4, t, "equal-slice-v23-custom-p") 812 testReleaseBytes(bs23) 813 } 814 var v24va [8]int 815 for _, v := range [][]int{nil, {}, {127, 0, 0, 111}} { 816 var v24v1, v24v2 []int 817 var bs24 []byte 818 v24v1 = v 819 bs24 = testMarshalErr(v24v1, h, t, "enc-slice-v24") 820 if v == nil { 821 v24v2 = make([]int, 2) 822 testUnmarshalErr(v24v2, bs24, h, t, "dec-slice-v24") 823 testDeepEqualErr(v24v2[0], v24v2[1], t, "equal-slice-v24") // should not change 824 testDeepEqualErr(len(v24v2), 2, t, "equal-slice-v24") // should not change 825 v24v2 = make([]int, 2) 826 testUnmarshalErr(reflect.ValueOf(v24v2), bs24, h, t, "dec-slice-v24-noaddr") // non-addressable value 827 testDeepEqualErr(v24v2[0], v24v2[1], t, "equal-slice-v24-noaddr") // should not change 828 testDeepEqualErr(len(v24v2), 2, t, "equal-slice-v24") // should not change 829 } else { 830 v24v2 = make([]int, len(v)) 831 testUnmarshalErr(v24v2, bs24, h, t, "dec-slice-v24") 832 testDeepEqualErr(v24v1, v24v2, t, "equal-slice-v24") 833 v24v2 = make([]int, len(v)) 834 testUnmarshalErr(reflect.ValueOf(v24v2), bs24, h, t, "dec-slice-v24-noaddr") // non-addressable value 835 testDeepEqualErr(v24v1, v24v2, t, "equal-slice-v24-noaddr") 836 } 837 testReleaseBytes(bs24) 838 // ... 839 bs24 = testMarshalErr(&v24v1, h, t, "enc-slice-v24-p") 840 v24v2 = nil 841 testUnmarshalErr(&v24v2, bs24, h, t, "dec-slice-v24-p") 842 testDeepEqualErr(v24v1, v24v2, t, "equal-slice-v24-p") 843 v24va = [8]int{} // clear the array 844 testUnmarshalErr(&v24va, bs24, h, t, "dec-array-v24-p-1") 845 if v24v1 == nil && v24v2 == nil { 846 v24v2 = []int{} 847 } // so we can compare to zero len slice below 848 testDeepEqualErr(v24va[:len(v24v2)], v24v2, t, "equal-array-v24-p-1") 849 v24va = [8]int{} // clear the array 850 v24v2 = v24va[:1:1] 851 testUnmarshalErr(&v24v2, bs24, h, t, "dec-slice-v24-p-1") 852 testDeepEqualErr(v24v1, v24v2, t, "equal-slice-v24-p-1") 853 v24va = [8]int{} // clear the array 854 v24v2 = v24va[:len(v24v1):len(v24v1)] 855 testUnmarshalErr(&v24v2, bs24, h, t, "dec-slice-v24-p-len") 856 testDeepEqualErr(v24v1, v24v2, t, "equal-slice-v24-p-len") 857 v24va = [8]int{} // clear the array 858 v24v2 = v24va[:] 859 testUnmarshalErr(&v24v2, bs24, h, t, "dec-slice-v24-p-cap") 860 testDeepEqualErr(v24v1, v24v2, t, "equal-slice-v24-p-cap") 861 if len(v24v1) > 1 { 862 v24va = [8]int{} // clear the array 863 testUnmarshalErr((&v24va)[:len(v24v1)], bs24, h, t, "dec-slice-v24-p-len-noaddr") 864 testDeepEqualErr(v24v1, v24va[:len(v24v1)], t, "equal-slice-v24-p-len-noaddr") 865 v24va = [8]int{} // clear the array 866 testUnmarshalErr((&v24va)[:], bs24, h, t, "dec-slice-v24-p-cap-noaddr") 867 testDeepEqualErr(v24v1, v24va[:len(v24v1)], t, "equal-slice-v24-p-cap-noaddr") 868 } 869 testReleaseBytes(bs24) 870 // ... 871 var v24v3, v24v4 typMbsSliceInt 872 v24v2 = nil 873 if v != nil { 874 v24v2 = make([]int, len(v)) 875 } 876 v24v3 = typMbsSliceInt(v24v1) 877 v24v4 = typMbsSliceInt(v24v2) 878 if v != nil { 879 bs24 = testMarshalErr(v24v3, h, t, "enc-slice-v24-custom") 880 testUnmarshalErr(v24v4, bs24, h, t, "dec-slice-v24-custom") 881 testDeepEqualErr(v24v3, v24v4, t, "equal-slice-v24-custom") 882 testReleaseBytes(bs24) 883 } 884 bs24 = testMarshalErr(&v24v3, h, t, "enc-slice-v24-custom-p") 885 v24v2 = nil 886 v24v4 = typMbsSliceInt(v24v2) 887 testUnmarshalErr(&v24v4, bs24, h, t, "dec-slice-v24-custom-p") 888 testDeepEqualErr(v24v3, v24v4, t, "equal-slice-v24-custom-p") 889 testReleaseBytes(bs24) 890 } 891 var v25va [8]int32 892 for _, v := range [][]int32{nil, {}, {77, 0, 0, 127}} { 893 var v25v1, v25v2 []int32 894 var bs25 []byte 895 v25v1 = v 896 bs25 = testMarshalErr(v25v1, h, t, "enc-slice-v25") 897 if v == nil { 898 v25v2 = make([]int32, 2) 899 testUnmarshalErr(v25v2, bs25, h, t, "dec-slice-v25") 900 testDeepEqualErr(v25v2[0], v25v2[1], t, "equal-slice-v25") // should not change 901 testDeepEqualErr(len(v25v2), 2, t, "equal-slice-v25") // should not change 902 v25v2 = make([]int32, 2) 903 testUnmarshalErr(reflect.ValueOf(v25v2), bs25, h, t, "dec-slice-v25-noaddr") // non-addressable value 904 testDeepEqualErr(v25v2[0], v25v2[1], t, "equal-slice-v25-noaddr") // should not change 905 testDeepEqualErr(len(v25v2), 2, t, "equal-slice-v25") // should not change 906 } else { 907 v25v2 = make([]int32, len(v)) 908 testUnmarshalErr(v25v2, bs25, h, t, "dec-slice-v25") 909 testDeepEqualErr(v25v1, v25v2, t, "equal-slice-v25") 910 v25v2 = make([]int32, len(v)) 911 testUnmarshalErr(reflect.ValueOf(v25v2), bs25, h, t, "dec-slice-v25-noaddr") // non-addressable value 912 testDeepEqualErr(v25v1, v25v2, t, "equal-slice-v25-noaddr") 913 } 914 testReleaseBytes(bs25) 915 // ... 916 bs25 = testMarshalErr(&v25v1, h, t, "enc-slice-v25-p") 917 v25v2 = nil 918 testUnmarshalErr(&v25v2, bs25, h, t, "dec-slice-v25-p") 919 testDeepEqualErr(v25v1, v25v2, t, "equal-slice-v25-p") 920 v25va = [8]int32{} // clear the array 921 testUnmarshalErr(&v25va, bs25, h, t, "dec-array-v25-p-1") 922 if v25v1 == nil && v25v2 == nil { 923 v25v2 = []int32{} 924 } // so we can compare to zero len slice below 925 testDeepEqualErr(v25va[:len(v25v2)], v25v2, t, "equal-array-v25-p-1") 926 v25va = [8]int32{} // clear the array 927 v25v2 = v25va[:1:1] 928 testUnmarshalErr(&v25v2, bs25, h, t, "dec-slice-v25-p-1") 929 testDeepEqualErr(v25v1, v25v2, t, "equal-slice-v25-p-1") 930 v25va = [8]int32{} // clear the array 931 v25v2 = v25va[:len(v25v1):len(v25v1)] 932 testUnmarshalErr(&v25v2, bs25, h, t, "dec-slice-v25-p-len") 933 testDeepEqualErr(v25v1, v25v2, t, "equal-slice-v25-p-len") 934 v25va = [8]int32{} // clear the array 935 v25v2 = v25va[:] 936 testUnmarshalErr(&v25v2, bs25, h, t, "dec-slice-v25-p-cap") 937 testDeepEqualErr(v25v1, v25v2, t, "equal-slice-v25-p-cap") 938 if len(v25v1) > 1 { 939 v25va = [8]int32{} // clear the array 940 testUnmarshalErr((&v25va)[:len(v25v1)], bs25, h, t, "dec-slice-v25-p-len-noaddr") 941 testDeepEqualErr(v25v1, v25va[:len(v25v1)], t, "equal-slice-v25-p-len-noaddr") 942 v25va = [8]int32{} // clear the array 943 testUnmarshalErr((&v25va)[:], bs25, h, t, "dec-slice-v25-p-cap-noaddr") 944 testDeepEqualErr(v25v1, v25va[:len(v25v1)], t, "equal-slice-v25-p-cap-noaddr") 945 } 946 testReleaseBytes(bs25) 947 // ... 948 var v25v3, v25v4 typMbsSliceInt32 949 v25v2 = nil 950 if v != nil { 951 v25v2 = make([]int32, len(v)) 952 } 953 v25v3 = typMbsSliceInt32(v25v1) 954 v25v4 = typMbsSliceInt32(v25v2) 955 if v != nil { 956 bs25 = testMarshalErr(v25v3, h, t, "enc-slice-v25-custom") 957 testUnmarshalErr(v25v4, bs25, h, t, "dec-slice-v25-custom") 958 testDeepEqualErr(v25v3, v25v4, t, "equal-slice-v25-custom") 959 testReleaseBytes(bs25) 960 } 961 bs25 = testMarshalErr(&v25v3, h, t, "enc-slice-v25-custom-p") 962 v25v2 = nil 963 v25v4 = typMbsSliceInt32(v25v2) 964 testUnmarshalErr(&v25v4, bs25, h, t, "dec-slice-v25-custom-p") 965 testDeepEqualErr(v25v3, v25v4, t, "equal-slice-v25-custom-p") 966 testReleaseBytes(bs25) 967 } 968 var v26va [8]int64 969 for _, v := range [][]int64{nil, {}, {111, 0, 0, 77}} { 970 var v26v1, v26v2 []int64 971 var bs26 []byte 972 v26v1 = v 973 bs26 = testMarshalErr(v26v1, h, t, "enc-slice-v26") 974 if v == nil { 975 v26v2 = make([]int64, 2) 976 testUnmarshalErr(v26v2, bs26, h, t, "dec-slice-v26") 977 testDeepEqualErr(v26v2[0], v26v2[1], t, "equal-slice-v26") // should not change 978 testDeepEqualErr(len(v26v2), 2, t, "equal-slice-v26") // should not change 979 v26v2 = make([]int64, 2) 980 testUnmarshalErr(reflect.ValueOf(v26v2), bs26, h, t, "dec-slice-v26-noaddr") // non-addressable value 981 testDeepEqualErr(v26v2[0], v26v2[1], t, "equal-slice-v26-noaddr") // should not change 982 testDeepEqualErr(len(v26v2), 2, t, "equal-slice-v26") // should not change 983 } else { 984 v26v2 = make([]int64, len(v)) 985 testUnmarshalErr(v26v2, bs26, h, t, "dec-slice-v26") 986 testDeepEqualErr(v26v1, v26v2, t, "equal-slice-v26") 987 v26v2 = make([]int64, len(v)) 988 testUnmarshalErr(reflect.ValueOf(v26v2), bs26, h, t, "dec-slice-v26-noaddr") // non-addressable value 989 testDeepEqualErr(v26v1, v26v2, t, "equal-slice-v26-noaddr") 990 } 991 testReleaseBytes(bs26) 992 // ... 993 bs26 = testMarshalErr(&v26v1, h, t, "enc-slice-v26-p") 994 v26v2 = nil 995 testUnmarshalErr(&v26v2, bs26, h, t, "dec-slice-v26-p") 996 testDeepEqualErr(v26v1, v26v2, t, "equal-slice-v26-p") 997 v26va = [8]int64{} // clear the array 998 testUnmarshalErr(&v26va, bs26, h, t, "dec-array-v26-p-1") 999 if v26v1 == nil && v26v2 == nil { 1000 v26v2 = []int64{} 1001 } // so we can compare to zero len slice below 1002 testDeepEqualErr(v26va[:len(v26v2)], v26v2, t, "equal-array-v26-p-1") 1003 v26va = [8]int64{} // clear the array 1004 v26v2 = v26va[:1:1] 1005 testUnmarshalErr(&v26v2, bs26, h, t, "dec-slice-v26-p-1") 1006 testDeepEqualErr(v26v1, v26v2, t, "equal-slice-v26-p-1") 1007 v26va = [8]int64{} // clear the array 1008 v26v2 = v26va[:len(v26v1):len(v26v1)] 1009 testUnmarshalErr(&v26v2, bs26, h, t, "dec-slice-v26-p-len") 1010 testDeepEqualErr(v26v1, v26v2, t, "equal-slice-v26-p-len") 1011 v26va = [8]int64{} // clear the array 1012 v26v2 = v26va[:] 1013 testUnmarshalErr(&v26v2, bs26, h, t, "dec-slice-v26-p-cap") 1014 testDeepEqualErr(v26v1, v26v2, t, "equal-slice-v26-p-cap") 1015 if len(v26v1) > 1 { 1016 v26va = [8]int64{} // clear the array 1017 testUnmarshalErr((&v26va)[:len(v26v1)], bs26, h, t, "dec-slice-v26-p-len-noaddr") 1018 testDeepEqualErr(v26v1, v26va[:len(v26v1)], t, "equal-slice-v26-p-len-noaddr") 1019 v26va = [8]int64{} // clear the array 1020 testUnmarshalErr((&v26va)[:], bs26, h, t, "dec-slice-v26-p-cap-noaddr") 1021 testDeepEqualErr(v26v1, v26va[:len(v26v1)], t, "equal-slice-v26-p-cap-noaddr") 1022 } 1023 testReleaseBytes(bs26) 1024 // ... 1025 var v26v3, v26v4 typMbsSliceInt64 1026 v26v2 = nil 1027 if v != nil { 1028 v26v2 = make([]int64, len(v)) 1029 } 1030 v26v3 = typMbsSliceInt64(v26v1) 1031 v26v4 = typMbsSliceInt64(v26v2) 1032 if v != nil { 1033 bs26 = testMarshalErr(v26v3, h, t, "enc-slice-v26-custom") 1034 testUnmarshalErr(v26v4, bs26, h, t, "dec-slice-v26-custom") 1035 testDeepEqualErr(v26v3, v26v4, t, "equal-slice-v26-custom") 1036 testReleaseBytes(bs26) 1037 } 1038 bs26 = testMarshalErr(&v26v3, h, t, "enc-slice-v26-custom-p") 1039 v26v2 = nil 1040 v26v4 = typMbsSliceInt64(v26v2) 1041 testUnmarshalErr(&v26v4, bs26, h, t, "dec-slice-v26-custom-p") 1042 testDeepEqualErr(v26v3, v26v4, t, "equal-slice-v26-custom-p") 1043 testReleaseBytes(bs26) 1044 } 1045 var v27va [8]bool 1046 for _, v := range [][]bool{nil, {}, {false, false, false, true}} { 1047 var v27v1, v27v2 []bool 1048 var bs27 []byte 1049 v27v1 = v 1050 bs27 = testMarshalErr(v27v1, h, t, "enc-slice-v27") 1051 if v == nil { 1052 v27v2 = make([]bool, 2) 1053 testUnmarshalErr(v27v2, bs27, h, t, "dec-slice-v27") 1054 testDeepEqualErr(v27v2[0], v27v2[1], t, "equal-slice-v27") // should not change 1055 testDeepEqualErr(len(v27v2), 2, t, "equal-slice-v27") // should not change 1056 v27v2 = make([]bool, 2) 1057 testUnmarshalErr(reflect.ValueOf(v27v2), bs27, h, t, "dec-slice-v27-noaddr") // non-addressable value 1058 testDeepEqualErr(v27v2[0], v27v2[1], t, "equal-slice-v27-noaddr") // should not change 1059 testDeepEqualErr(len(v27v2), 2, t, "equal-slice-v27") // should not change 1060 } else { 1061 v27v2 = make([]bool, len(v)) 1062 testUnmarshalErr(v27v2, bs27, h, t, "dec-slice-v27") 1063 testDeepEqualErr(v27v1, v27v2, t, "equal-slice-v27") 1064 v27v2 = make([]bool, len(v)) 1065 testUnmarshalErr(reflect.ValueOf(v27v2), bs27, h, t, "dec-slice-v27-noaddr") // non-addressable value 1066 testDeepEqualErr(v27v1, v27v2, t, "equal-slice-v27-noaddr") 1067 } 1068 testReleaseBytes(bs27) 1069 // ... 1070 bs27 = testMarshalErr(&v27v1, h, t, "enc-slice-v27-p") 1071 v27v2 = nil 1072 testUnmarshalErr(&v27v2, bs27, h, t, "dec-slice-v27-p") 1073 testDeepEqualErr(v27v1, v27v2, t, "equal-slice-v27-p") 1074 v27va = [8]bool{} // clear the array 1075 testUnmarshalErr(&v27va, bs27, h, t, "dec-array-v27-p-1") 1076 if v27v1 == nil && v27v2 == nil { 1077 v27v2 = []bool{} 1078 } // so we can compare to zero len slice below 1079 testDeepEqualErr(v27va[:len(v27v2)], v27v2, t, "equal-array-v27-p-1") 1080 v27va = [8]bool{} // clear the array 1081 v27v2 = v27va[:1:1] 1082 testUnmarshalErr(&v27v2, bs27, h, t, "dec-slice-v27-p-1") 1083 testDeepEqualErr(v27v1, v27v2, t, "equal-slice-v27-p-1") 1084 v27va = [8]bool{} // clear the array 1085 v27v2 = v27va[:len(v27v1):len(v27v1)] 1086 testUnmarshalErr(&v27v2, bs27, h, t, "dec-slice-v27-p-len") 1087 testDeepEqualErr(v27v1, v27v2, t, "equal-slice-v27-p-len") 1088 v27va = [8]bool{} // clear the array 1089 v27v2 = v27va[:] 1090 testUnmarshalErr(&v27v2, bs27, h, t, "dec-slice-v27-p-cap") 1091 testDeepEqualErr(v27v1, v27v2, t, "equal-slice-v27-p-cap") 1092 if len(v27v1) > 1 { 1093 v27va = [8]bool{} // clear the array 1094 testUnmarshalErr((&v27va)[:len(v27v1)], bs27, h, t, "dec-slice-v27-p-len-noaddr") 1095 testDeepEqualErr(v27v1, v27va[:len(v27v1)], t, "equal-slice-v27-p-len-noaddr") 1096 v27va = [8]bool{} // clear the array 1097 testUnmarshalErr((&v27va)[:], bs27, h, t, "dec-slice-v27-p-cap-noaddr") 1098 testDeepEqualErr(v27v1, v27va[:len(v27v1)], t, "equal-slice-v27-p-cap-noaddr") 1099 } 1100 testReleaseBytes(bs27) 1101 // ... 1102 var v27v3, v27v4 typMbsSliceBool 1103 v27v2 = nil 1104 if v != nil { 1105 v27v2 = make([]bool, len(v)) 1106 } 1107 v27v3 = typMbsSliceBool(v27v1) 1108 v27v4 = typMbsSliceBool(v27v2) 1109 if v != nil { 1110 bs27 = testMarshalErr(v27v3, h, t, "enc-slice-v27-custom") 1111 testUnmarshalErr(v27v4, bs27, h, t, "dec-slice-v27-custom") 1112 testDeepEqualErr(v27v3, v27v4, t, "equal-slice-v27-custom") 1113 testReleaseBytes(bs27) 1114 } 1115 bs27 = testMarshalErr(&v27v3, h, t, "enc-slice-v27-custom-p") 1116 v27v2 = nil 1117 v27v4 = typMbsSliceBool(v27v2) 1118 testUnmarshalErr(&v27v4, bs27, h, t, "dec-slice-v27-custom-p") 1119 testDeepEqualErr(v27v3, v27v4, t, "equal-slice-v27-custom-p") 1120 testReleaseBytes(bs27) 1121 } 1122 1123 } 1124 1125 func __doTestMammothMaps(t *testing.T, h Handle) { 1126 for _, v := range []map[string]interface{}{nil, {}, {"some-string-1": nil, "some-string-2": "string-is-an-interface-1"}} { 1127 // fmt.Printf(">>>> running mammoth map v28: %v\n", v) 1128 var v28v1, v28v2 map[string]interface{} 1129 var bs28 []byte 1130 v28v1 = v 1131 bs28 = testMarshalErr(v28v1, h, t, "enc-map-v28") 1132 if v != nil { 1133 if v == nil { 1134 v28v2 = nil 1135 } else { 1136 v28v2 = make(map[string]interface{}, len(v)) 1137 } // reset map 1138 testUnmarshalErr(v28v2, bs28, h, t, "dec-map-v28") 1139 testDeepEqualErr(v28v1, v28v2, t, "equal-map-v28") 1140 if v == nil { 1141 v28v2 = nil 1142 } else { 1143 v28v2 = make(map[string]interface{}, len(v)) 1144 } // reset map 1145 testUnmarshalErr(reflect.ValueOf(v28v2), bs28, h, t, "dec-map-v28-noaddr") // decode into non-addressable map value 1146 testDeepEqualErr(v28v1, v28v2, t, "equal-map-v28-noaddr") 1147 } 1148 if v == nil { 1149 v28v2 = nil 1150 } else { 1151 v28v2 = make(map[string]interface{}, len(v)) 1152 } // reset map 1153 testUnmarshalErr(&v28v2, bs28, h, t, "dec-map-v28-p-len") 1154 testDeepEqualErr(v28v1, v28v2, t, "equal-map-v28-p-len") 1155 testReleaseBytes(bs28) 1156 bs28 = testMarshalErr(&v28v1, h, t, "enc-map-v28-p") 1157 v28v2 = nil 1158 testUnmarshalErr(&v28v2, bs28, h, t, "dec-map-v28-p-nil") 1159 testDeepEqualErr(v28v1, v28v2, t, "equal-map-v28-p-nil") 1160 testReleaseBytes(bs28) 1161 // ... 1162 if v == nil { 1163 v28v2 = nil 1164 } else { 1165 v28v2 = make(map[string]interface{}, len(v)) 1166 } // reset map 1167 var v28v3, v28v4 typMapMapStringIntf 1168 v28v3 = typMapMapStringIntf(v28v1) 1169 v28v4 = typMapMapStringIntf(v28v2) 1170 if v != nil { 1171 bs28 = testMarshalErr(v28v3, h, t, "enc-map-v28-custom") 1172 testUnmarshalErr(v28v4, bs28, h, t, "dec-map-v28-p-len") 1173 testDeepEqualErr(v28v3, v28v4, t, "equal-map-v28-p-len") 1174 testReleaseBytes(bs28) 1175 } 1176 } 1177 for _, v := range []map[string]string{nil, {}, {"some-string-3": "", "some-string-1": "some-string-2"}} { 1178 // fmt.Printf(">>>> running mammoth map v29: %v\n", v) 1179 var v29v1, v29v2 map[string]string 1180 var bs29 []byte 1181 v29v1 = v 1182 bs29 = testMarshalErr(v29v1, h, t, "enc-map-v29") 1183 if v != nil { 1184 if v == nil { 1185 v29v2 = nil 1186 } else { 1187 v29v2 = make(map[string]string, len(v)) 1188 } // reset map 1189 testUnmarshalErr(v29v2, bs29, h, t, "dec-map-v29") 1190 testDeepEqualErr(v29v1, v29v2, t, "equal-map-v29") 1191 if v == nil { 1192 v29v2 = nil 1193 } else { 1194 v29v2 = make(map[string]string, len(v)) 1195 } // reset map 1196 testUnmarshalErr(reflect.ValueOf(v29v2), bs29, h, t, "dec-map-v29-noaddr") // decode into non-addressable map value 1197 testDeepEqualErr(v29v1, v29v2, t, "equal-map-v29-noaddr") 1198 } 1199 if v == nil { 1200 v29v2 = nil 1201 } else { 1202 v29v2 = make(map[string]string, len(v)) 1203 } // reset map 1204 testUnmarshalErr(&v29v2, bs29, h, t, "dec-map-v29-p-len") 1205 testDeepEqualErr(v29v1, v29v2, t, "equal-map-v29-p-len") 1206 testReleaseBytes(bs29) 1207 bs29 = testMarshalErr(&v29v1, h, t, "enc-map-v29-p") 1208 v29v2 = nil 1209 testUnmarshalErr(&v29v2, bs29, h, t, "dec-map-v29-p-nil") 1210 testDeepEqualErr(v29v1, v29v2, t, "equal-map-v29-p-nil") 1211 testReleaseBytes(bs29) 1212 // ... 1213 if v == nil { 1214 v29v2 = nil 1215 } else { 1216 v29v2 = make(map[string]string, len(v)) 1217 } // reset map 1218 var v29v3, v29v4 typMapMapStringString 1219 v29v3 = typMapMapStringString(v29v1) 1220 v29v4 = typMapMapStringString(v29v2) 1221 if v != nil { 1222 bs29 = testMarshalErr(v29v3, h, t, "enc-map-v29-custom") 1223 testUnmarshalErr(v29v4, bs29, h, t, "dec-map-v29-p-len") 1224 testDeepEqualErr(v29v3, v29v4, t, "equal-map-v29-p-len") 1225 testReleaseBytes(bs29) 1226 } 1227 } 1228 for _, v := range []map[string][]byte{nil, {}, {"some-string-3": nil, "some-string-1": []byte("some-string-1")}} { 1229 // fmt.Printf(">>>> running mammoth map v30: %v\n", v) 1230 var v30v1, v30v2 map[string][]byte 1231 var bs30 []byte 1232 v30v1 = v 1233 bs30 = testMarshalErr(v30v1, h, t, "enc-map-v30") 1234 if v != nil { 1235 if v == nil { 1236 v30v2 = nil 1237 } else { 1238 v30v2 = make(map[string][]byte, len(v)) 1239 } // reset map 1240 testUnmarshalErr(v30v2, bs30, h, t, "dec-map-v30") 1241 testDeepEqualErr(v30v1, v30v2, t, "equal-map-v30") 1242 if v == nil { 1243 v30v2 = nil 1244 } else { 1245 v30v2 = make(map[string][]byte, len(v)) 1246 } // reset map 1247 testUnmarshalErr(reflect.ValueOf(v30v2), bs30, h, t, "dec-map-v30-noaddr") // decode into non-addressable map value 1248 testDeepEqualErr(v30v1, v30v2, t, "equal-map-v30-noaddr") 1249 } 1250 if v == nil { 1251 v30v2 = nil 1252 } else { 1253 v30v2 = make(map[string][]byte, len(v)) 1254 } // reset map 1255 testUnmarshalErr(&v30v2, bs30, h, t, "dec-map-v30-p-len") 1256 testDeepEqualErr(v30v1, v30v2, t, "equal-map-v30-p-len") 1257 testReleaseBytes(bs30) 1258 bs30 = testMarshalErr(&v30v1, h, t, "enc-map-v30-p") 1259 v30v2 = nil 1260 testUnmarshalErr(&v30v2, bs30, h, t, "dec-map-v30-p-nil") 1261 testDeepEqualErr(v30v1, v30v2, t, "equal-map-v30-p-nil") 1262 testReleaseBytes(bs30) 1263 // ... 1264 if v == nil { 1265 v30v2 = nil 1266 } else { 1267 v30v2 = make(map[string][]byte, len(v)) 1268 } // reset map 1269 var v30v3, v30v4 typMapMapStringBytes 1270 v30v3 = typMapMapStringBytes(v30v1) 1271 v30v4 = typMapMapStringBytes(v30v2) 1272 if v != nil { 1273 bs30 = testMarshalErr(v30v3, h, t, "enc-map-v30-custom") 1274 testUnmarshalErr(v30v4, bs30, h, t, "dec-map-v30-p-len") 1275 testDeepEqualErr(v30v3, v30v4, t, "equal-map-v30-p-len") 1276 testReleaseBytes(bs30) 1277 } 1278 } 1279 for _, v := range []map[string]uint8{nil, {}, {"some-string-2": 0, "some-string-3": 127}} { 1280 // fmt.Printf(">>>> running mammoth map v31: %v\n", v) 1281 var v31v1, v31v2 map[string]uint8 1282 var bs31 []byte 1283 v31v1 = v 1284 bs31 = testMarshalErr(v31v1, h, t, "enc-map-v31") 1285 if v != nil { 1286 if v == nil { 1287 v31v2 = nil 1288 } else { 1289 v31v2 = make(map[string]uint8, len(v)) 1290 } // reset map 1291 testUnmarshalErr(v31v2, bs31, h, t, "dec-map-v31") 1292 testDeepEqualErr(v31v1, v31v2, t, "equal-map-v31") 1293 if v == nil { 1294 v31v2 = nil 1295 } else { 1296 v31v2 = make(map[string]uint8, len(v)) 1297 } // reset map 1298 testUnmarshalErr(reflect.ValueOf(v31v2), bs31, h, t, "dec-map-v31-noaddr") // decode into non-addressable map value 1299 testDeepEqualErr(v31v1, v31v2, t, "equal-map-v31-noaddr") 1300 } 1301 if v == nil { 1302 v31v2 = nil 1303 } else { 1304 v31v2 = make(map[string]uint8, len(v)) 1305 } // reset map 1306 testUnmarshalErr(&v31v2, bs31, h, t, "dec-map-v31-p-len") 1307 testDeepEqualErr(v31v1, v31v2, t, "equal-map-v31-p-len") 1308 testReleaseBytes(bs31) 1309 bs31 = testMarshalErr(&v31v1, h, t, "enc-map-v31-p") 1310 v31v2 = nil 1311 testUnmarshalErr(&v31v2, bs31, h, t, "dec-map-v31-p-nil") 1312 testDeepEqualErr(v31v1, v31v2, t, "equal-map-v31-p-nil") 1313 testReleaseBytes(bs31) 1314 // ... 1315 if v == nil { 1316 v31v2 = nil 1317 } else { 1318 v31v2 = make(map[string]uint8, len(v)) 1319 } // reset map 1320 var v31v3, v31v4 typMapMapStringUint8 1321 v31v3 = typMapMapStringUint8(v31v1) 1322 v31v4 = typMapMapStringUint8(v31v2) 1323 if v != nil { 1324 bs31 = testMarshalErr(v31v3, h, t, "enc-map-v31-custom") 1325 testUnmarshalErr(v31v4, bs31, h, t, "dec-map-v31-p-len") 1326 testDeepEqualErr(v31v3, v31v4, t, "equal-map-v31-p-len") 1327 testReleaseBytes(bs31) 1328 } 1329 } 1330 for _, v := range []map[string]uint64{nil, {}, {"some-string-1": 0, "some-string-2": 111}} { 1331 // fmt.Printf(">>>> running mammoth map v32: %v\n", v) 1332 var v32v1, v32v2 map[string]uint64 1333 var bs32 []byte 1334 v32v1 = v 1335 bs32 = testMarshalErr(v32v1, h, t, "enc-map-v32") 1336 if v != nil { 1337 if v == nil { 1338 v32v2 = nil 1339 } else { 1340 v32v2 = make(map[string]uint64, len(v)) 1341 } // reset map 1342 testUnmarshalErr(v32v2, bs32, h, t, "dec-map-v32") 1343 testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32") 1344 if v == nil { 1345 v32v2 = nil 1346 } else { 1347 v32v2 = make(map[string]uint64, len(v)) 1348 } // reset map 1349 testUnmarshalErr(reflect.ValueOf(v32v2), bs32, h, t, "dec-map-v32-noaddr") // decode into non-addressable map value 1350 testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32-noaddr") 1351 } 1352 if v == nil { 1353 v32v2 = nil 1354 } else { 1355 v32v2 = make(map[string]uint64, len(v)) 1356 } // reset map 1357 testUnmarshalErr(&v32v2, bs32, h, t, "dec-map-v32-p-len") 1358 testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32-p-len") 1359 testReleaseBytes(bs32) 1360 bs32 = testMarshalErr(&v32v1, h, t, "enc-map-v32-p") 1361 v32v2 = nil 1362 testUnmarshalErr(&v32v2, bs32, h, t, "dec-map-v32-p-nil") 1363 testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32-p-nil") 1364 testReleaseBytes(bs32) 1365 // ... 1366 if v == nil { 1367 v32v2 = nil 1368 } else { 1369 v32v2 = make(map[string]uint64, len(v)) 1370 } // reset map 1371 var v32v3, v32v4 typMapMapStringUint64 1372 v32v3 = typMapMapStringUint64(v32v1) 1373 v32v4 = typMapMapStringUint64(v32v2) 1374 if v != nil { 1375 bs32 = testMarshalErr(v32v3, h, t, "enc-map-v32-custom") 1376 testUnmarshalErr(v32v4, bs32, h, t, "dec-map-v32-p-len") 1377 testDeepEqualErr(v32v3, v32v4, t, "equal-map-v32-p-len") 1378 testReleaseBytes(bs32) 1379 } 1380 } 1381 for _, v := range []map[string]int{nil, {}, {"some-string-3": 0, "some-string-1": 77}} { 1382 // fmt.Printf(">>>> running mammoth map v33: %v\n", v) 1383 var v33v1, v33v2 map[string]int 1384 var bs33 []byte 1385 v33v1 = v 1386 bs33 = testMarshalErr(v33v1, h, t, "enc-map-v33") 1387 if v != nil { 1388 if v == nil { 1389 v33v2 = nil 1390 } else { 1391 v33v2 = make(map[string]int, len(v)) 1392 } // reset map 1393 testUnmarshalErr(v33v2, bs33, h, t, "dec-map-v33") 1394 testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33") 1395 if v == nil { 1396 v33v2 = nil 1397 } else { 1398 v33v2 = make(map[string]int, len(v)) 1399 } // reset map 1400 testUnmarshalErr(reflect.ValueOf(v33v2), bs33, h, t, "dec-map-v33-noaddr") // decode into non-addressable map value 1401 testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33-noaddr") 1402 } 1403 if v == nil { 1404 v33v2 = nil 1405 } else { 1406 v33v2 = make(map[string]int, len(v)) 1407 } // reset map 1408 testUnmarshalErr(&v33v2, bs33, h, t, "dec-map-v33-p-len") 1409 testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33-p-len") 1410 testReleaseBytes(bs33) 1411 bs33 = testMarshalErr(&v33v1, h, t, "enc-map-v33-p") 1412 v33v2 = nil 1413 testUnmarshalErr(&v33v2, bs33, h, t, "dec-map-v33-p-nil") 1414 testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33-p-nil") 1415 testReleaseBytes(bs33) 1416 // ... 1417 if v == nil { 1418 v33v2 = nil 1419 } else { 1420 v33v2 = make(map[string]int, len(v)) 1421 } // reset map 1422 var v33v3, v33v4 typMapMapStringInt 1423 v33v3 = typMapMapStringInt(v33v1) 1424 v33v4 = typMapMapStringInt(v33v2) 1425 if v != nil { 1426 bs33 = testMarshalErr(v33v3, h, t, "enc-map-v33-custom") 1427 testUnmarshalErr(v33v4, bs33, h, t, "dec-map-v33-p-len") 1428 testDeepEqualErr(v33v3, v33v4, t, "equal-map-v33-p-len") 1429 testReleaseBytes(bs33) 1430 } 1431 } 1432 for _, v := range []map[string]int32{nil, {}, {"some-string-2": 0, "some-string-3": 127}} { 1433 // fmt.Printf(">>>> running mammoth map v34: %v\n", v) 1434 var v34v1, v34v2 map[string]int32 1435 var bs34 []byte 1436 v34v1 = v 1437 bs34 = testMarshalErr(v34v1, h, t, "enc-map-v34") 1438 if v != nil { 1439 if v == nil { 1440 v34v2 = nil 1441 } else { 1442 v34v2 = make(map[string]int32, len(v)) 1443 } // reset map 1444 testUnmarshalErr(v34v2, bs34, h, t, "dec-map-v34") 1445 testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34") 1446 if v == nil { 1447 v34v2 = nil 1448 } else { 1449 v34v2 = make(map[string]int32, len(v)) 1450 } // reset map 1451 testUnmarshalErr(reflect.ValueOf(v34v2), bs34, h, t, "dec-map-v34-noaddr") // decode into non-addressable map value 1452 testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34-noaddr") 1453 } 1454 if v == nil { 1455 v34v2 = nil 1456 } else { 1457 v34v2 = make(map[string]int32, len(v)) 1458 } // reset map 1459 testUnmarshalErr(&v34v2, bs34, h, t, "dec-map-v34-p-len") 1460 testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34-p-len") 1461 testReleaseBytes(bs34) 1462 bs34 = testMarshalErr(&v34v1, h, t, "enc-map-v34-p") 1463 v34v2 = nil 1464 testUnmarshalErr(&v34v2, bs34, h, t, "dec-map-v34-p-nil") 1465 testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34-p-nil") 1466 testReleaseBytes(bs34) 1467 // ... 1468 if v == nil { 1469 v34v2 = nil 1470 } else { 1471 v34v2 = make(map[string]int32, len(v)) 1472 } // reset map 1473 var v34v3, v34v4 typMapMapStringInt32 1474 v34v3 = typMapMapStringInt32(v34v1) 1475 v34v4 = typMapMapStringInt32(v34v2) 1476 if v != nil { 1477 bs34 = testMarshalErr(v34v3, h, t, "enc-map-v34-custom") 1478 testUnmarshalErr(v34v4, bs34, h, t, "dec-map-v34-p-len") 1479 testDeepEqualErr(v34v3, v34v4, t, "equal-map-v34-p-len") 1480 testReleaseBytes(bs34) 1481 } 1482 } 1483 for _, v := range []map[string]float64{nil, {}, {"some-string-1": 0, "some-string-2": 33.3e3}} { 1484 // fmt.Printf(">>>> running mammoth map v35: %v\n", v) 1485 var v35v1, v35v2 map[string]float64 1486 var bs35 []byte 1487 v35v1 = v 1488 bs35 = testMarshalErr(v35v1, h, t, "enc-map-v35") 1489 if v != nil { 1490 if v == nil { 1491 v35v2 = nil 1492 } else { 1493 v35v2 = make(map[string]float64, len(v)) 1494 } // reset map 1495 testUnmarshalErr(v35v2, bs35, h, t, "dec-map-v35") 1496 testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35") 1497 if v == nil { 1498 v35v2 = nil 1499 } else { 1500 v35v2 = make(map[string]float64, len(v)) 1501 } // reset map 1502 testUnmarshalErr(reflect.ValueOf(v35v2), bs35, h, t, "dec-map-v35-noaddr") // decode into non-addressable map value 1503 testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35-noaddr") 1504 } 1505 if v == nil { 1506 v35v2 = nil 1507 } else { 1508 v35v2 = make(map[string]float64, len(v)) 1509 } // reset map 1510 testUnmarshalErr(&v35v2, bs35, h, t, "dec-map-v35-p-len") 1511 testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35-p-len") 1512 testReleaseBytes(bs35) 1513 bs35 = testMarshalErr(&v35v1, h, t, "enc-map-v35-p") 1514 v35v2 = nil 1515 testUnmarshalErr(&v35v2, bs35, h, t, "dec-map-v35-p-nil") 1516 testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35-p-nil") 1517 testReleaseBytes(bs35) 1518 // ... 1519 if v == nil { 1520 v35v2 = nil 1521 } else { 1522 v35v2 = make(map[string]float64, len(v)) 1523 } // reset map 1524 var v35v3, v35v4 typMapMapStringFloat64 1525 v35v3 = typMapMapStringFloat64(v35v1) 1526 v35v4 = typMapMapStringFloat64(v35v2) 1527 if v != nil { 1528 bs35 = testMarshalErr(v35v3, h, t, "enc-map-v35-custom") 1529 testUnmarshalErr(v35v4, bs35, h, t, "dec-map-v35-p-len") 1530 testDeepEqualErr(v35v3, v35v4, t, "equal-map-v35-p-len") 1531 testReleaseBytes(bs35) 1532 } 1533 } 1534 for _, v := range []map[string]bool{nil, {}, {"some-string-3": false, "some-string-1": true}} { 1535 // fmt.Printf(">>>> running mammoth map v36: %v\n", v) 1536 var v36v1, v36v2 map[string]bool 1537 var bs36 []byte 1538 v36v1 = v 1539 bs36 = testMarshalErr(v36v1, h, t, "enc-map-v36") 1540 if v != nil { 1541 if v == nil { 1542 v36v2 = nil 1543 } else { 1544 v36v2 = make(map[string]bool, len(v)) 1545 } // reset map 1546 testUnmarshalErr(v36v2, bs36, h, t, "dec-map-v36") 1547 testDeepEqualErr(v36v1, v36v2, t, "equal-map-v36") 1548 if v == nil { 1549 v36v2 = nil 1550 } else { 1551 v36v2 = make(map[string]bool, len(v)) 1552 } // reset map 1553 testUnmarshalErr(reflect.ValueOf(v36v2), bs36, h, t, "dec-map-v36-noaddr") // decode into non-addressable map value 1554 testDeepEqualErr(v36v1, v36v2, t, "equal-map-v36-noaddr") 1555 } 1556 if v == nil { 1557 v36v2 = nil 1558 } else { 1559 v36v2 = make(map[string]bool, len(v)) 1560 } // reset map 1561 testUnmarshalErr(&v36v2, bs36, h, t, "dec-map-v36-p-len") 1562 testDeepEqualErr(v36v1, v36v2, t, "equal-map-v36-p-len") 1563 testReleaseBytes(bs36) 1564 bs36 = testMarshalErr(&v36v1, h, t, "enc-map-v36-p") 1565 v36v2 = nil 1566 testUnmarshalErr(&v36v2, bs36, h, t, "dec-map-v36-p-nil") 1567 testDeepEqualErr(v36v1, v36v2, t, "equal-map-v36-p-nil") 1568 testReleaseBytes(bs36) 1569 // ... 1570 if v == nil { 1571 v36v2 = nil 1572 } else { 1573 v36v2 = make(map[string]bool, len(v)) 1574 } // reset map 1575 var v36v3, v36v4 typMapMapStringBool 1576 v36v3 = typMapMapStringBool(v36v1) 1577 v36v4 = typMapMapStringBool(v36v2) 1578 if v != nil { 1579 bs36 = testMarshalErr(v36v3, h, t, "enc-map-v36-custom") 1580 testUnmarshalErr(v36v4, bs36, h, t, "dec-map-v36-p-len") 1581 testDeepEqualErr(v36v3, v36v4, t, "equal-map-v36-p-len") 1582 testReleaseBytes(bs36) 1583 } 1584 } 1585 for _, v := range []map[uint8]interface{}{nil, {}, {111: nil, 77: "string-is-an-interface-2"}} { 1586 // fmt.Printf(">>>> running mammoth map v37: %v\n", v) 1587 var v37v1, v37v2 map[uint8]interface{} 1588 var bs37 []byte 1589 v37v1 = v 1590 bs37 = testMarshalErr(v37v1, h, t, "enc-map-v37") 1591 if v != nil { 1592 if v == nil { 1593 v37v2 = nil 1594 } else { 1595 v37v2 = make(map[uint8]interface{}, len(v)) 1596 } // reset map 1597 testUnmarshalErr(v37v2, bs37, h, t, "dec-map-v37") 1598 testDeepEqualErr(v37v1, v37v2, t, "equal-map-v37") 1599 if v == nil { 1600 v37v2 = nil 1601 } else { 1602 v37v2 = make(map[uint8]interface{}, len(v)) 1603 } // reset map 1604 testUnmarshalErr(reflect.ValueOf(v37v2), bs37, h, t, "dec-map-v37-noaddr") // decode into non-addressable map value 1605 testDeepEqualErr(v37v1, v37v2, t, "equal-map-v37-noaddr") 1606 } 1607 if v == nil { 1608 v37v2 = nil 1609 } else { 1610 v37v2 = make(map[uint8]interface{}, len(v)) 1611 } // reset map 1612 testUnmarshalErr(&v37v2, bs37, h, t, "dec-map-v37-p-len") 1613 testDeepEqualErr(v37v1, v37v2, t, "equal-map-v37-p-len") 1614 testReleaseBytes(bs37) 1615 bs37 = testMarshalErr(&v37v1, h, t, "enc-map-v37-p") 1616 v37v2 = nil 1617 testUnmarshalErr(&v37v2, bs37, h, t, "dec-map-v37-p-nil") 1618 testDeepEqualErr(v37v1, v37v2, t, "equal-map-v37-p-nil") 1619 testReleaseBytes(bs37) 1620 // ... 1621 if v == nil { 1622 v37v2 = nil 1623 } else { 1624 v37v2 = make(map[uint8]interface{}, len(v)) 1625 } // reset map 1626 var v37v3, v37v4 typMapMapUint8Intf 1627 v37v3 = typMapMapUint8Intf(v37v1) 1628 v37v4 = typMapMapUint8Intf(v37v2) 1629 if v != nil { 1630 bs37 = testMarshalErr(v37v3, h, t, "enc-map-v37-custom") 1631 testUnmarshalErr(v37v4, bs37, h, t, "dec-map-v37-p-len") 1632 testDeepEqualErr(v37v3, v37v4, t, "equal-map-v37-p-len") 1633 testReleaseBytes(bs37) 1634 } 1635 } 1636 for _, v := range []map[uint8]string{nil, {}, {127: "", 111: "some-string-2"}} { 1637 // fmt.Printf(">>>> running mammoth map v38: %v\n", v) 1638 var v38v1, v38v2 map[uint8]string 1639 var bs38 []byte 1640 v38v1 = v 1641 bs38 = testMarshalErr(v38v1, h, t, "enc-map-v38") 1642 if v != nil { 1643 if v == nil { 1644 v38v2 = nil 1645 } else { 1646 v38v2 = make(map[uint8]string, len(v)) 1647 } // reset map 1648 testUnmarshalErr(v38v2, bs38, h, t, "dec-map-v38") 1649 testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38") 1650 if v == nil { 1651 v38v2 = nil 1652 } else { 1653 v38v2 = make(map[uint8]string, len(v)) 1654 } // reset map 1655 testUnmarshalErr(reflect.ValueOf(v38v2), bs38, h, t, "dec-map-v38-noaddr") // decode into non-addressable map value 1656 testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38-noaddr") 1657 } 1658 if v == nil { 1659 v38v2 = nil 1660 } else { 1661 v38v2 = make(map[uint8]string, len(v)) 1662 } // reset map 1663 testUnmarshalErr(&v38v2, bs38, h, t, "dec-map-v38-p-len") 1664 testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38-p-len") 1665 testReleaseBytes(bs38) 1666 bs38 = testMarshalErr(&v38v1, h, t, "enc-map-v38-p") 1667 v38v2 = nil 1668 testUnmarshalErr(&v38v2, bs38, h, t, "dec-map-v38-p-nil") 1669 testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38-p-nil") 1670 testReleaseBytes(bs38) 1671 // ... 1672 if v == nil { 1673 v38v2 = nil 1674 } else { 1675 v38v2 = make(map[uint8]string, len(v)) 1676 } // reset map 1677 var v38v3, v38v4 typMapMapUint8String 1678 v38v3 = typMapMapUint8String(v38v1) 1679 v38v4 = typMapMapUint8String(v38v2) 1680 if v != nil { 1681 bs38 = testMarshalErr(v38v3, h, t, "enc-map-v38-custom") 1682 testUnmarshalErr(v38v4, bs38, h, t, "dec-map-v38-p-len") 1683 testDeepEqualErr(v38v3, v38v4, t, "equal-map-v38-p-len") 1684 testReleaseBytes(bs38) 1685 } 1686 } 1687 for _, v := range []map[uint8][]byte{nil, {}, {77: nil, 127: []byte("some-string-2")}} { 1688 // fmt.Printf(">>>> running mammoth map v39: %v\n", v) 1689 var v39v1, v39v2 map[uint8][]byte 1690 var bs39 []byte 1691 v39v1 = v 1692 bs39 = testMarshalErr(v39v1, h, t, "enc-map-v39") 1693 if v != nil { 1694 if v == nil { 1695 v39v2 = nil 1696 } else { 1697 v39v2 = make(map[uint8][]byte, len(v)) 1698 } // reset map 1699 testUnmarshalErr(v39v2, bs39, h, t, "dec-map-v39") 1700 testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39") 1701 if v == nil { 1702 v39v2 = nil 1703 } else { 1704 v39v2 = make(map[uint8][]byte, len(v)) 1705 } // reset map 1706 testUnmarshalErr(reflect.ValueOf(v39v2), bs39, h, t, "dec-map-v39-noaddr") // decode into non-addressable map value 1707 testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39-noaddr") 1708 } 1709 if v == nil { 1710 v39v2 = nil 1711 } else { 1712 v39v2 = make(map[uint8][]byte, len(v)) 1713 } // reset map 1714 testUnmarshalErr(&v39v2, bs39, h, t, "dec-map-v39-p-len") 1715 testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39-p-len") 1716 testReleaseBytes(bs39) 1717 bs39 = testMarshalErr(&v39v1, h, t, "enc-map-v39-p") 1718 v39v2 = nil 1719 testUnmarshalErr(&v39v2, bs39, h, t, "dec-map-v39-p-nil") 1720 testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39-p-nil") 1721 testReleaseBytes(bs39) 1722 // ... 1723 if v == nil { 1724 v39v2 = nil 1725 } else { 1726 v39v2 = make(map[uint8][]byte, len(v)) 1727 } // reset map 1728 var v39v3, v39v4 typMapMapUint8Bytes 1729 v39v3 = typMapMapUint8Bytes(v39v1) 1730 v39v4 = typMapMapUint8Bytes(v39v2) 1731 if v != nil { 1732 bs39 = testMarshalErr(v39v3, h, t, "enc-map-v39-custom") 1733 testUnmarshalErr(v39v4, bs39, h, t, "dec-map-v39-p-len") 1734 testDeepEqualErr(v39v3, v39v4, t, "equal-map-v39-p-len") 1735 testReleaseBytes(bs39) 1736 } 1737 } 1738 for _, v := range []map[uint8]uint8{nil, {}, {111: 0, 77: 127}} { 1739 // fmt.Printf(">>>> running mammoth map v40: %v\n", v) 1740 var v40v1, v40v2 map[uint8]uint8 1741 var bs40 []byte 1742 v40v1 = v 1743 bs40 = testMarshalErr(v40v1, h, t, "enc-map-v40") 1744 if v != nil { 1745 if v == nil { 1746 v40v2 = nil 1747 } else { 1748 v40v2 = make(map[uint8]uint8, len(v)) 1749 } // reset map 1750 testUnmarshalErr(v40v2, bs40, h, t, "dec-map-v40") 1751 testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40") 1752 if v == nil { 1753 v40v2 = nil 1754 } else { 1755 v40v2 = make(map[uint8]uint8, len(v)) 1756 } // reset map 1757 testUnmarshalErr(reflect.ValueOf(v40v2), bs40, h, t, "dec-map-v40-noaddr") // decode into non-addressable map value 1758 testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40-noaddr") 1759 } 1760 if v == nil { 1761 v40v2 = nil 1762 } else { 1763 v40v2 = make(map[uint8]uint8, len(v)) 1764 } // reset map 1765 testUnmarshalErr(&v40v2, bs40, h, t, "dec-map-v40-p-len") 1766 testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40-p-len") 1767 testReleaseBytes(bs40) 1768 bs40 = testMarshalErr(&v40v1, h, t, "enc-map-v40-p") 1769 v40v2 = nil 1770 testUnmarshalErr(&v40v2, bs40, h, t, "dec-map-v40-p-nil") 1771 testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40-p-nil") 1772 testReleaseBytes(bs40) 1773 // ... 1774 if v == nil { 1775 v40v2 = nil 1776 } else { 1777 v40v2 = make(map[uint8]uint8, len(v)) 1778 } // reset map 1779 var v40v3, v40v4 typMapMapUint8Uint8 1780 v40v3 = typMapMapUint8Uint8(v40v1) 1781 v40v4 = typMapMapUint8Uint8(v40v2) 1782 if v != nil { 1783 bs40 = testMarshalErr(v40v3, h, t, "enc-map-v40-custom") 1784 testUnmarshalErr(v40v4, bs40, h, t, "dec-map-v40-p-len") 1785 testDeepEqualErr(v40v3, v40v4, t, "equal-map-v40-p-len") 1786 testReleaseBytes(bs40) 1787 } 1788 } 1789 for _, v := range []map[uint8]uint64{nil, {}, {111: 0, 77: 127}} { 1790 // fmt.Printf(">>>> running mammoth map v41: %v\n", v) 1791 var v41v1, v41v2 map[uint8]uint64 1792 var bs41 []byte 1793 v41v1 = v 1794 bs41 = testMarshalErr(v41v1, h, t, "enc-map-v41") 1795 if v != nil { 1796 if v == nil { 1797 v41v2 = nil 1798 } else { 1799 v41v2 = make(map[uint8]uint64, len(v)) 1800 } // reset map 1801 testUnmarshalErr(v41v2, bs41, h, t, "dec-map-v41") 1802 testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41") 1803 if v == nil { 1804 v41v2 = nil 1805 } else { 1806 v41v2 = make(map[uint8]uint64, len(v)) 1807 } // reset map 1808 testUnmarshalErr(reflect.ValueOf(v41v2), bs41, h, t, "dec-map-v41-noaddr") // decode into non-addressable map value 1809 testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41-noaddr") 1810 } 1811 if v == nil { 1812 v41v2 = nil 1813 } else { 1814 v41v2 = make(map[uint8]uint64, len(v)) 1815 } // reset map 1816 testUnmarshalErr(&v41v2, bs41, h, t, "dec-map-v41-p-len") 1817 testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41-p-len") 1818 testReleaseBytes(bs41) 1819 bs41 = testMarshalErr(&v41v1, h, t, "enc-map-v41-p") 1820 v41v2 = nil 1821 testUnmarshalErr(&v41v2, bs41, h, t, "dec-map-v41-p-nil") 1822 testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41-p-nil") 1823 testReleaseBytes(bs41) 1824 // ... 1825 if v == nil { 1826 v41v2 = nil 1827 } else { 1828 v41v2 = make(map[uint8]uint64, len(v)) 1829 } // reset map 1830 var v41v3, v41v4 typMapMapUint8Uint64 1831 v41v3 = typMapMapUint8Uint64(v41v1) 1832 v41v4 = typMapMapUint8Uint64(v41v2) 1833 if v != nil { 1834 bs41 = testMarshalErr(v41v3, h, t, "enc-map-v41-custom") 1835 testUnmarshalErr(v41v4, bs41, h, t, "dec-map-v41-p-len") 1836 testDeepEqualErr(v41v3, v41v4, t, "equal-map-v41-p-len") 1837 testReleaseBytes(bs41) 1838 } 1839 } 1840 for _, v := range []map[uint8]int{nil, {}, {111: 0, 77: 127}} { 1841 // fmt.Printf(">>>> running mammoth map v42: %v\n", v) 1842 var v42v1, v42v2 map[uint8]int 1843 var bs42 []byte 1844 v42v1 = v 1845 bs42 = testMarshalErr(v42v1, h, t, "enc-map-v42") 1846 if v != nil { 1847 if v == nil { 1848 v42v2 = nil 1849 } else { 1850 v42v2 = make(map[uint8]int, len(v)) 1851 } // reset map 1852 testUnmarshalErr(v42v2, bs42, h, t, "dec-map-v42") 1853 testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42") 1854 if v == nil { 1855 v42v2 = nil 1856 } else { 1857 v42v2 = make(map[uint8]int, len(v)) 1858 } // reset map 1859 testUnmarshalErr(reflect.ValueOf(v42v2), bs42, h, t, "dec-map-v42-noaddr") // decode into non-addressable map value 1860 testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42-noaddr") 1861 } 1862 if v == nil { 1863 v42v2 = nil 1864 } else { 1865 v42v2 = make(map[uint8]int, len(v)) 1866 } // reset map 1867 testUnmarshalErr(&v42v2, bs42, h, t, "dec-map-v42-p-len") 1868 testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42-p-len") 1869 testReleaseBytes(bs42) 1870 bs42 = testMarshalErr(&v42v1, h, t, "enc-map-v42-p") 1871 v42v2 = nil 1872 testUnmarshalErr(&v42v2, bs42, h, t, "dec-map-v42-p-nil") 1873 testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42-p-nil") 1874 testReleaseBytes(bs42) 1875 // ... 1876 if v == nil { 1877 v42v2 = nil 1878 } else { 1879 v42v2 = make(map[uint8]int, len(v)) 1880 } // reset map 1881 var v42v3, v42v4 typMapMapUint8Int 1882 v42v3 = typMapMapUint8Int(v42v1) 1883 v42v4 = typMapMapUint8Int(v42v2) 1884 if v != nil { 1885 bs42 = testMarshalErr(v42v3, h, t, "enc-map-v42-custom") 1886 testUnmarshalErr(v42v4, bs42, h, t, "dec-map-v42-p-len") 1887 testDeepEqualErr(v42v3, v42v4, t, "equal-map-v42-p-len") 1888 testReleaseBytes(bs42) 1889 } 1890 } 1891 for _, v := range []map[uint8]int32{nil, {}, {111: 0, 77: 127}} { 1892 // fmt.Printf(">>>> running mammoth map v43: %v\n", v) 1893 var v43v1, v43v2 map[uint8]int32 1894 var bs43 []byte 1895 v43v1 = v 1896 bs43 = testMarshalErr(v43v1, h, t, "enc-map-v43") 1897 if v != nil { 1898 if v == nil { 1899 v43v2 = nil 1900 } else { 1901 v43v2 = make(map[uint8]int32, len(v)) 1902 } // reset map 1903 testUnmarshalErr(v43v2, bs43, h, t, "dec-map-v43") 1904 testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43") 1905 if v == nil { 1906 v43v2 = nil 1907 } else { 1908 v43v2 = make(map[uint8]int32, len(v)) 1909 } // reset map 1910 testUnmarshalErr(reflect.ValueOf(v43v2), bs43, h, t, "dec-map-v43-noaddr") // decode into non-addressable map value 1911 testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43-noaddr") 1912 } 1913 if v == nil { 1914 v43v2 = nil 1915 } else { 1916 v43v2 = make(map[uint8]int32, len(v)) 1917 } // reset map 1918 testUnmarshalErr(&v43v2, bs43, h, t, "dec-map-v43-p-len") 1919 testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43-p-len") 1920 testReleaseBytes(bs43) 1921 bs43 = testMarshalErr(&v43v1, h, t, "enc-map-v43-p") 1922 v43v2 = nil 1923 testUnmarshalErr(&v43v2, bs43, h, t, "dec-map-v43-p-nil") 1924 testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43-p-nil") 1925 testReleaseBytes(bs43) 1926 // ... 1927 if v == nil { 1928 v43v2 = nil 1929 } else { 1930 v43v2 = make(map[uint8]int32, len(v)) 1931 } // reset map 1932 var v43v3, v43v4 typMapMapUint8Int32 1933 v43v3 = typMapMapUint8Int32(v43v1) 1934 v43v4 = typMapMapUint8Int32(v43v2) 1935 if v != nil { 1936 bs43 = testMarshalErr(v43v3, h, t, "enc-map-v43-custom") 1937 testUnmarshalErr(v43v4, bs43, h, t, "dec-map-v43-p-len") 1938 testDeepEqualErr(v43v3, v43v4, t, "equal-map-v43-p-len") 1939 testReleaseBytes(bs43) 1940 } 1941 } 1942 for _, v := range []map[uint8]float64{nil, {}, {111: 0, 77: 11.1}} { 1943 // fmt.Printf(">>>> running mammoth map v44: %v\n", v) 1944 var v44v1, v44v2 map[uint8]float64 1945 var bs44 []byte 1946 v44v1 = v 1947 bs44 = testMarshalErr(v44v1, h, t, "enc-map-v44") 1948 if v != nil { 1949 if v == nil { 1950 v44v2 = nil 1951 } else { 1952 v44v2 = make(map[uint8]float64, len(v)) 1953 } // reset map 1954 testUnmarshalErr(v44v2, bs44, h, t, "dec-map-v44") 1955 testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44") 1956 if v == nil { 1957 v44v2 = nil 1958 } else { 1959 v44v2 = make(map[uint8]float64, len(v)) 1960 } // reset map 1961 testUnmarshalErr(reflect.ValueOf(v44v2), bs44, h, t, "dec-map-v44-noaddr") // decode into non-addressable map value 1962 testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44-noaddr") 1963 } 1964 if v == nil { 1965 v44v2 = nil 1966 } else { 1967 v44v2 = make(map[uint8]float64, len(v)) 1968 } // reset map 1969 testUnmarshalErr(&v44v2, bs44, h, t, "dec-map-v44-p-len") 1970 testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44-p-len") 1971 testReleaseBytes(bs44) 1972 bs44 = testMarshalErr(&v44v1, h, t, "enc-map-v44-p") 1973 v44v2 = nil 1974 testUnmarshalErr(&v44v2, bs44, h, t, "dec-map-v44-p-nil") 1975 testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44-p-nil") 1976 testReleaseBytes(bs44) 1977 // ... 1978 if v == nil { 1979 v44v2 = nil 1980 } else { 1981 v44v2 = make(map[uint8]float64, len(v)) 1982 } // reset map 1983 var v44v3, v44v4 typMapMapUint8Float64 1984 v44v3 = typMapMapUint8Float64(v44v1) 1985 v44v4 = typMapMapUint8Float64(v44v2) 1986 if v != nil { 1987 bs44 = testMarshalErr(v44v3, h, t, "enc-map-v44-custom") 1988 testUnmarshalErr(v44v4, bs44, h, t, "dec-map-v44-p-len") 1989 testDeepEqualErr(v44v3, v44v4, t, "equal-map-v44-p-len") 1990 testReleaseBytes(bs44) 1991 } 1992 } 1993 for _, v := range []map[uint8]bool{nil, {}, {127: false, 111: false}} { 1994 // fmt.Printf(">>>> running mammoth map v45: %v\n", v) 1995 var v45v1, v45v2 map[uint8]bool 1996 var bs45 []byte 1997 v45v1 = v 1998 bs45 = testMarshalErr(v45v1, h, t, "enc-map-v45") 1999 if v != nil { 2000 if v == nil { 2001 v45v2 = nil 2002 } else { 2003 v45v2 = make(map[uint8]bool, len(v)) 2004 } // reset map 2005 testUnmarshalErr(v45v2, bs45, h, t, "dec-map-v45") 2006 testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45") 2007 if v == nil { 2008 v45v2 = nil 2009 } else { 2010 v45v2 = make(map[uint8]bool, len(v)) 2011 } // reset map 2012 testUnmarshalErr(reflect.ValueOf(v45v2), bs45, h, t, "dec-map-v45-noaddr") // decode into non-addressable map value 2013 testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45-noaddr") 2014 } 2015 if v == nil { 2016 v45v2 = nil 2017 } else { 2018 v45v2 = make(map[uint8]bool, len(v)) 2019 } // reset map 2020 testUnmarshalErr(&v45v2, bs45, h, t, "dec-map-v45-p-len") 2021 testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45-p-len") 2022 testReleaseBytes(bs45) 2023 bs45 = testMarshalErr(&v45v1, h, t, "enc-map-v45-p") 2024 v45v2 = nil 2025 testUnmarshalErr(&v45v2, bs45, h, t, "dec-map-v45-p-nil") 2026 testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45-p-nil") 2027 testReleaseBytes(bs45) 2028 // ... 2029 if v == nil { 2030 v45v2 = nil 2031 } else { 2032 v45v2 = make(map[uint8]bool, len(v)) 2033 } // reset map 2034 var v45v3, v45v4 typMapMapUint8Bool 2035 v45v3 = typMapMapUint8Bool(v45v1) 2036 v45v4 = typMapMapUint8Bool(v45v2) 2037 if v != nil { 2038 bs45 = testMarshalErr(v45v3, h, t, "enc-map-v45-custom") 2039 testUnmarshalErr(v45v4, bs45, h, t, "dec-map-v45-p-len") 2040 testDeepEqualErr(v45v3, v45v4, t, "equal-map-v45-p-len") 2041 testReleaseBytes(bs45) 2042 } 2043 } 2044 for _, v := range []map[uint64]interface{}{nil, {}, {77: nil, 127: "string-is-an-interface-3"}} { 2045 // fmt.Printf(">>>> running mammoth map v46: %v\n", v) 2046 var v46v1, v46v2 map[uint64]interface{} 2047 var bs46 []byte 2048 v46v1 = v 2049 bs46 = testMarshalErr(v46v1, h, t, "enc-map-v46") 2050 if v != nil { 2051 if v == nil { 2052 v46v2 = nil 2053 } else { 2054 v46v2 = make(map[uint64]interface{}, len(v)) 2055 } // reset map 2056 testUnmarshalErr(v46v2, bs46, h, t, "dec-map-v46") 2057 testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46") 2058 if v == nil { 2059 v46v2 = nil 2060 } else { 2061 v46v2 = make(map[uint64]interface{}, len(v)) 2062 } // reset map 2063 testUnmarshalErr(reflect.ValueOf(v46v2), bs46, h, t, "dec-map-v46-noaddr") // decode into non-addressable map value 2064 testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46-noaddr") 2065 } 2066 if v == nil { 2067 v46v2 = nil 2068 } else { 2069 v46v2 = make(map[uint64]interface{}, len(v)) 2070 } // reset map 2071 testUnmarshalErr(&v46v2, bs46, h, t, "dec-map-v46-p-len") 2072 testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46-p-len") 2073 testReleaseBytes(bs46) 2074 bs46 = testMarshalErr(&v46v1, h, t, "enc-map-v46-p") 2075 v46v2 = nil 2076 testUnmarshalErr(&v46v2, bs46, h, t, "dec-map-v46-p-nil") 2077 testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46-p-nil") 2078 testReleaseBytes(bs46) 2079 // ... 2080 if v == nil { 2081 v46v2 = nil 2082 } else { 2083 v46v2 = make(map[uint64]interface{}, len(v)) 2084 } // reset map 2085 var v46v3, v46v4 typMapMapUint64Intf 2086 v46v3 = typMapMapUint64Intf(v46v1) 2087 v46v4 = typMapMapUint64Intf(v46v2) 2088 if v != nil { 2089 bs46 = testMarshalErr(v46v3, h, t, "enc-map-v46-custom") 2090 testUnmarshalErr(v46v4, bs46, h, t, "dec-map-v46-p-len") 2091 testDeepEqualErr(v46v3, v46v4, t, "equal-map-v46-p-len") 2092 testReleaseBytes(bs46) 2093 } 2094 } 2095 for _, v := range []map[uint64]string{nil, {}, {111: "", 77: "some-string-3"}} { 2096 // fmt.Printf(">>>> running mammoth map v47: %v\n", v) 2097 var v47v1, v47v2 map[uint64]string 2098 var bs47 []byte 2099 v47v1 = v 2100 bs47 = testMarshalErr(v47v1, h, t, "enc-map-v47") 2101 if v != nil { 2102 if v == nil { 2103 v47v2 = nil 2104 } else { 2105 v47v2 = make(map[uint64]string, len(v)) 2106 } // reset map 2107 testUnmarshalErr(v47v2, bs47, h, t, "dec-map-v47") 2108 testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47") 2109 if v == nil { 2110 v47v2 = nil 2111 } else { 2112 v47v2 = make(map[uint64]string, len(v)) 2113 } // reset map 2114 testUnmarshalErr(reflect.ValueOf(v47v2), bs47, h, t, "dec-map-v47-noaddr") // decode into non-addressable map value 2115 testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47-noaddr") 2116 } 2117 if v == nil { 2118 v47v2 = nil 2119 } else { 2120 v47v2 = make(map[uint64]string, len(v)) 2121 } // reset map 2122 testUnmarshalErr(&v47v2, bs47, h, t, "dec-map-v47-p-len") 2123 testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47-p-len") 2124 testReleaseBytes(bs47) 2125 bs47 = testMarshalErr(&v47v1, h, t, "enc-map-v47-p") 2126 v47v2 = nil 2127 testUnmarshalErr(&v47v2, bs47, h, t, "dec-map-v47-p-nil") 2128 testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47-p-nil") 2129 testReleaseBytes(bs47) 2130 // ... 2131 if v == nil { 2132 v47v2 = nil 2133 } else { 2134 v47v2 = make(map[uint64]string, len(v)) 2135 } // reset map 2136 var v47v3, v47v4 typMapMapUint64String 2137 v47v3 = typMapMapUint64String(v47v1) 2138 v47v4 = typMapMapUint64String(v47v2) 2139 if v != nil { 2140 bs47 = testMarshalErr(v47v3, h, t, "enc-map-v47-custom") 2141 testUnmarshalErr(v47v4, bs47, h, t, "dec-map-v47-p-len") 2142 testDeepEqualErr(v47v3, v47v4, t, "equal-map-v47-p-len") 2143 testReleaseBytes(bs47) 2144 } 2145 } 2146 for _, v := range []map[uint64][]byte{nil, {}, {127: nil, 111: []byte("some-string-3")}} { 2147 // fmt.Printf(">>>> running mammoth map v48: %v\n", v) 2148 var v48v1, v48v2 map[uint64][]byte 2149 var bs48 []byte 2150 v48v1 = v 2151 bs48 = testMarshalErr(v48v1, h, t, "enc-map-v48") 2152 if v != nil { 2153 if v == nil { 2154 v48v2 = nil 2155 } else { 2156 v48v2 = make(map[uint64][]byte, len(v)) 2157 } // reset map 2158 testUnmarshalErr(v48v2, bs48, h, t, "dec-map-v48") 2159 testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48") 2160 if v == nil { 2161 v48v2 = nil 2162 } else { 2163 v48v2 = make(map[uint64][]byte, len(v)) 2164 } // reset map 2165 testUnmarshalErr(reflect.ValueOf(v48v2), bs48, h, t, "dec-map-v48-noaddr") // decode into non-addressable map value 2166 testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48-noaddr") 2167 } 2168 if v == nil { 2169 v48v2 = nil 2170 } else { 2171 v48v2 = make(map[uint64][]byte, len(v)) 2172 } // reset map 2173 testUnmarshalErr(&v48v2, bs48, h, t, "dec-map-v48-p-len") 2174 testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48-p-len") 2175 testReleaseBytes(bs48) 2176 bs48 = testMarshalErr(&v48v1, h, t, "enc-map-v48-p") 2177 v48v2 = nil 2178 testUnmarshalErr(&v48v2, bs48, h, t, "dec-map-v48-p-nil") 2179 testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48-p-nil") 2180 testReleaseBytes(bs48) 2181 // ... 2182 if v == nil { 2183 v48v2 = nil 2184 } else { 2185 v48v2 = make(map[uint64][]byte, len(v)) 2186 } // reset map 2187 var v48v3, v48v4 typMapMapUint64Bytes 2188 v48v3 = typMapMapUint64Bytes(v48v1) 2189 v48v4 = typMapMapUint64Bytes(v48v2) 2190 if v != nil { 2191 bs48 = testMarshalErr(v48v3, h, t, "enc-map-v48-custom") 2192 testUnmarshalErr(v48v4, bs48, h, t, "dec-map-v48-p-len") 2193 testDeepEqualErr(v48v3, v48v4, t, "equal-map-v48-p-len") 2194 testReleaseBytes(bs48) 2195 } 2196 } 2197 for _, v := range []map[uint64]uint8{nil, {}, {77: 0, 127: 111}} { 2198 // fmt.Printf(">>>> running mammoth map v49: %v\n", v) 2199 var v49v1, v49v2 map[uint64]uint8 2200 var bs49 []byte 2201 v49v1 = v 2202 bs49 = testMarshalErr(v49v1, h, t, "enc-map-v49") 2203 if v != nil { 2204 if v == nil { 2205 v49v2 = nil 2206 } else { 2207 v49v2 = make(map[uint64]uint8, len(v)) 2208 } // reset map 2209 testUnmarshalErr(v49v2, bs49, h, t, "dec-map-v49") 2210 testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49") 2211 if v == nil { 2212 v49v2 = nil 2213 } else { 2214 v49v2 = make(map[uint64]uint8, len(v)) 2215 } // reset map 2216 testUnmarshalErr(reflect.ValueOf(v49v2), bs49, h, t, "dec-map-v49-noaddr") // decode into non-addressable map value 2217 testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49-noaddr") 2218 } 2219 if v == nil { 2220 v49v2 = nil 2221 } else { 2222 v49v2 = make(map[uint64]uint8, len(v)) 2223 } // reset map 2224 testUnmarshalErr(&v49v2, bs49, h, t, "dec-map-v49-p-len") 2225 testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49-p-len") 2226 testReleaseBytes(bs49) 2227 bs49 = testMarshalErr(&v49v1, h, t, "enc-map-v49-p") 2228 v49v2 = nil 2229 testUnmarshalErr(&v49v2, bs49, h, t, "dec-map-v49-p-nil") 2230 testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49-p-nil") 2231 testReleaseBytes(bs49) 2232 // ... 2233 if v == nil { 2234 v49v2 = nil 2235 } else { 2236 v49v2 = make(map[uint64]uint8, len(v)) 2237 } // reset map 2238 var v49v3, v49v4 typMapMapUint64Uint8 2239 v49v3 = typMapMapUint64Uint8(v49v1) 2240 v49v4 = typMapMapUint64Uint8(v49v2) 2241 if v != nil { 2242 bs49 = testMarshalErr(v49v3, h, t, "enc-map-v49-custom") 2243 testUnmarshalErr(v49v4, bs49, h, t, "dec-map-v49-p-len") 2244 testDeepEqualErr(v49v3, v49v4, t, "equal-map-v49-p-len") 2245 testReleaseBytes(bs49) 2246 } 2247 } 2248 for _, v := range []map[uint64]uint64{nil, {}, {77: 0, 127: 111}} { 2249 // fmt.Printf(">>>> running mammoth map v50: %v\n", v) 2250 var v50v1, v50v2 map[uint64]uint64 2251 var bs50 []byte 2252 v50v1 = v 2253 bs50 = testMarshalErr(v50v1, h, t, "enc-map-v50") 2254 if v != nil { 2255 if v == nil { 2256 v50v2 = nil 2257 } else { 2258 v50v2 = make(map[uint64]uint64, len(v)) 2259 } // reset map 2260 testUnmarshalErr(v50v2, bs50, h, t, "dec-map-v50") 2261 testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50") 2262 if v == nil { 2263 v50v2 = nil 2264 } else { 2265 v50v2 = make(map[uint64]uint64, len(v)) 2266 } // reset map 2267 testUnmarshalErr(reflect.ValueOf(v50v2), bs50, h, t, "dec-map-v50-noaddr") // decode into non-addressable map value 2268 testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50-noaddr") 2269 } 2270 if v == nil { 2271 v50v2 = nil 2272 } else { 2273 v50v2 = make(map[uint64]uint64, len(v)) 2274 } // reset map 2275 testUnmarshalErr(&v50v2, bs50, h, t, "dec-map-v50-p-len") 2276 testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50-p-len") 2277 testReleaseBytes(bs50) 2278 bs50 = testMarshalErr(&v50v1, h, t, "enc-map-v50-p") 2279 v50v2 = nil 2280 testUnmarshalErr(&v50v2, bs50, h, t, "dec-map-v50-p-nil") 2281 testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50-p-nil") 2282 testReleaseBytes(bs50) 2283 // ... 2284 if v == nil { 2285 v50v2 = nil 2286 } else { 2287 v50v2 = make(map[uint64]uint64, len(v)) 2288 } // reset map 2289 var v50v3, v50v4 typMapMapUint64Uint64 2290 v50v3 = typMapMapUint64Uint64(v50v1) 2291 v50v4 = typMapMapUint64Uint64(v50v2) 2292 if v != nil { 2293 bs50 = testMarshalErr(v50v3, h, t, "enc-map-v50-custom") 2294 testUnmarshalErr(v50v4, bs50, h, t, "dec-map-v50-p-len") 2295 testDeepEqualErr(v50v3, v50v4, t, "equal-map-v50-p-len") 2296 testReleaseBytes(bs50) 2297 } 2298 } 2299 for _, v := range []map[uint64]int{nil, {}, {77: 0, 127: 111}} { 2300 // fmt.Printf(">>>> running mammoth map v51: %v\n", v) 2301 var v51v1, v51v2 map[uint64]int 2302 var bs51 []byte 2303 v51v1 = v 2304 bs51 = testMarshalErr(v51v1, h, t, "enc-map-v51") 2305 if v != nil { 2306 if v == nil { 2307 v51v2 = nil 2308 } else { 2309 v51v2 = make(map[uint64]int, len(v)) 2310 } // reset map 2311 testUnmarshalErr(v51v2, bs51, h, t, "dec-map-v51") 2312 testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51") 2313 if v == nil { 2314 v51v2 = nil 2315 } else { 2316 v51v2 = make(map[uint64]int, len(v)) 2317 } // reset map 2318 testUnmarshalErr(reflect.ValueOf(v51v2), bs51, h, t, "dec-map-v51-noaddr") // decode into non-addressable map value 2319 testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51-noaddr") 2320 } 2321 if v == nil { 2322 v51v2 = nil 2323 } else { 2324 v51v2 = make(map[uint64]int, len(v)) 2325 } // reset map 2326 testUnmarshalErr(&v51v2, bs51, h, t, "dec-map-v51-p-len") 2327 testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51-p-len") 2328 testReleaseBytes(bs51) 2329 bs51 = testMarshalErr(&v51v1, h, t, "enc-map-v51-p") 2330 v51v2 = nil 2331 testUnmarshalErr(&v51v2, bs51, h, t, "dec-map-v51-p-nil") 2332 testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51-p-nil") 2333 testReleaseBytes(bs51) 2334 // ... 2335 if v == nil { 2336 v51v2 = nil 2337 } else { 2338 v51v2 = make(map[uint64]int, len(v)) 2339 } // reset map 2340 var v51v3, v51v4 typMapMapUint64Int 2341 v51v3 = typMapMapUint64Int(v51v1) 2342 v51v4 = typMapMapUint64Int(v51v2) 2343 if v != nil { 2344 bs51 = testMarshalErr(v51v3, h, t, "enc-map-v51-custom") 2345 testUnmarshalErr(v51v4, bs51, h, t, "dec-map-v51-p-len") 2346 testDeepEqualErr(v51v3, v51v4, t, "equal-map-v51-p-len") 2347 testReleaseBytes(bs51) 2348 } 2349 } 2350 for _, v := range []map[uint64]int32{nil, {}, {77: 0, 127: 111}} { 2351 // fmt.Printf(">>>> running mammoth map v52: %v\n", v) 2352 var v52v1, v52v2 map[uint64]int32 2353 var bs52 []byte 2354 v52v1 = v 2355 bs52 = testMarshalErr(v52v1, h, t, "enc-map-v52") 2356 if v != nil { 2357 if v == nil { 2358 v52v2 = nil 2359 } else { 2360 v52v2 = make(map[uint64]int32, len(v)) 2361 } // reset map 2362 testUnmarshalErr(v52v2, bs52, h, t, "dec-map-v52") 2363 testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52") 2364 if v == nil { 2365 v52v2 = nil 2366 } else { 2367 v52v2 = make(map[uint64]int32, len(v)) 2368 } // reset map 2369 testUnmarshalErr(reflect.ValueOf(v52v2), bs52, h, t, "dec-map-v52-noaddr") // decode into non-addressable map value 2370 testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52-noaddr") 2371 } 2372 if v == nil { 2373 v52v2 = nil 2374 } else { 2375 v52v2 = make(map[uint64]int32, len(v)) 2376 } // reset map 2377 testUnmarshalErr(&v52v2, bs52, h, t, "dec-map-v52-p-len") 2378 testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52-p-len") 2379 testReleaseBytes(bs52) 2380 bs52 = testMarshalErr(&v52v1, h, t, "enc-map-v52-p") 2381 v52v2 = nil 2382 testUnmarshalErr(&v52v2, bs52, h, t, "dec-map-v52-p-nil") 2383 testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52-p-nil") 2384 testReleaseBytes(bs52) 2385 // ... 2386 if v == nil { 2387 v52v2 = nil 2388 } else { 2389 v52v2 = make(map[uint64]int32, len(v)) 2390 } // reset map 2391 var v52v3, v52v4 typMapMapUint64Int32 2392 v52v3 = typMapMapUint64Int32(v52v1) 2393 v52v4 = typMapMapUint64Int32(v52v2) 2394 if v != nil { 2395 bs52 = testMarshalErr(v52v3, h, t, "enc-map-v52-custom") 2396 testUnmarshalErr(v52v4, bs52, h, t, "dec-map-v52-p-len") 2397 testDeepEqualErr(v52v3, v52v4, t, "equal-map-v52-p-len") 2398 testReleaseBytes(bs52) 2399 } 2400 } 2401 for _, v := range []map[uint64]float64{nil, {}, {77: 0, 127: 22.2}} { 2402 // fmt.Printf(">>>> running mammoth map v53: %v\n", v) 2403 var v53v1, v53v2 map[uint64]float64 2404 var bs53 []byte 2405 v53v1 = v 2406 bs53 = testMarshalErr(v53v1, h, t, "enc-map-v53") 2407 if v != nil { 2408 if v == nil { 2409 v53v2 = nil 2410 } else { 2411 v53v2 = make(map[uint64]float64, len(v)) 2412 } // reset map 2413 testUnmarshalErr(v53v2, bs53, h, t, "dec-map-v53") 2414 testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53") 2415 if v == nil { 2416 v53v2 = nil 2417 } else { 2418 v53v2 = make(map[uint64]float64, len(v)) 2419 } // reset map 2420 testUnmarshalErr(reflect.ValueOf(v53v2), bs53, h, t, "dec-map-v53-noaddr") // decode into non-addressable map value 2421 testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53-noaddr") 2422 } 2423 if v == nil { 2424 v53v2 = nil 2425 } else { 2426 v53v2 = make(map[uint64]float64, len(v)) 2427 } // reset map 2428 testUnmarshalErr(&v53v2, bs53, h, t, "dec-map-v53-p-len") 2429 testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53-p-len") 2430 testReleaseBytes(bs53) 2431 bs53 = testMarshalErr(&v53v1, h, t, "enc-map-v53-p") 2432 v53v2 = nil 2433 testUnmarshalErr(&v53v2, bs53, h, t, "dec-map-v53-p-nil") 2434 testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53-p-nil") 2435 testReleaseBytes(bs53) 2436 // ... 2437 if v == nil { 2438 v53v2 = nil 2439 } else { 2440 v53v2 = make(map[uint64]float64, len(v)) 2441 } // reset map 2442 var v53v3, v53v4 typMapMapUint64Float64 2443 v53v3 = typMapMapUint64Float64(v53v1) 2444 v53v4 = typMapMapUint64Float64(v53v2) 2445 if v != nil { 2446 bs53 = testMarshalErr(v53v3, h, t, "enc-map-v53-custom") 2447 testUnmarshalErr(v53v4, bs53, h, t, "dec-map-v53-p-len") 2448 testDeepEqualErr(v53v3, v53v4, t, "equal-map-v53-p-len") 2449 testReleaseBytes(bs53) 2450 } 2451 } 2452 for _, v := range []map[uint64]bool{nil, {}, {111: false, 77: true}} { 2453 // fmt.Printf(">>>> running mammoth map v54: %v\n", v) 2454 var v54v1, v54v2 map[uint64]bool 2455 var bs54 []byte 2456 v54v1 = v 2457 bs54 = testMarshalErr(v54v1, h, t, "enc-map-v54") 2458 if v != nil { 2459 if v == nil { 2460 v54v2 = nil 2461 } else { 2462 v54v2 = make(map[uint64]bool, len(v)) 2463 } // reset map 2464 testUnmarshalErr(v54v2, bs54, h, t, "dec-map-v54") 2465 testDeepEqualErr(v54v1, v54v2, t, "equal-map-v54") 2466 if v == nil { 2467 v54v2 = nil 2468 } else { 2469 v54v2 = make(map[uint64]bool, len(v)) 2470 } // reset map 2471 testUnmarshalErr(reflect.ValueOf(v54v2), bs54, h, t, "dec-map-v54-noaddr") // decode into non-addressable map value 2472 testDeepEqualErr(v54v1, v54v2, t, "equal-map-v54-noaddr") 2473 } 2474 if v == nil { 2475 v54v2 = nil 2476 } else { 2477 v54v2 = make(map[uint64]bool, len(v)) 2478 } // reset map 2479 testUnmarshalErr(&v54v2, bs54, h, t, "dec-map-v54-p-len") 2480 testDeepEqualErr(v54v1, v54v2, t, "equal-map-v54-p-len") 2481 testReleaseBytes(bs54) 2482 bs54 = testMarshalErr(&v54v1, h, t, "enc-map-v54-p") 2483 v54v2 = nil 2484 testUnmarshalErr(&v54v2, bs54, h, t, "dec-map-v54-p-nil") 2485 testDeepEqualErr(v54v1, v54v2, t, "equal-map-v54-p-nil") 2486 testReleaseBytes(bs54) 2487 // ... 2488 if v == nil { 2489 v54v2 = nil 2490 } else { 2491 v54v2 = make(map[uint64]bool, len(v)) 2492 } // reset map 2493 var v54v3, v54v4 typMapMapUint64Bool 2494 v54v3 = typMapMapUint64Bool(v54v1) 2495 v54v4 = typMapMapUint64Bool(v54v2) 2496 if v != nil { 2497 bs54 = testMarshalErr(v54v3, h, t, "enc-map-v54-custom") 2498 testUnmarshalErr(v54v4, bs54, h, t, "dec-map-v54-p-len") 2499 testDeepEqualErr(v54v3, v54v4, t, "equal-map-v54-p-len") 2500 testReleaseBytes(bs54) 2501 } 2502 } 2503 for _, v := range []map[int]interface{}{nil, {}, {127: nil, 111: "string-is-an-interface-1"}} { 2504 // fmt.Printf(">>>> running mammoth map v55: %v\n", v) 2505 var v55v1, v55v2 map[int]interface{} 2506 var bs55 []byte 2507 v55v1 = v 2508 bs55 = testMarshalErr(v55v1, h, t, "enc-map-v55") 2509 if v != nil { 2510 if v == nil { 2511 v55v2 = nil 2512 } else { 2513 v55v2 = make(map[int]interface{}, len(v)) 2514 } // reset map 2515 testUnmarshalErr(v55v2, bs55, h, t, "dec-map-v55") 2516 testDeepEqualErr(v55v1, v55v2, t, "equal-map-v55") 2517 if v == nil { 2518 v55v2 = nil 2519 } else { 2520 v55v2 = make(map[int]interface{}, len(v)) 2521 } // reset map 2522 testUnmarshalErr(reflect.ValueOf(v55v2), bs55, h, t, "dec-map-v55-noaddr") // decode into non-addressable map value 2523 testDeepEqualErr(v55v1, v55v2, t, "equal-map-v55-noaddr") 2524 } 2525 if v == nil { 2526 v55v2 = nil 2527 } else { 2528 v55v2 = make(map[int]interface{}, len(v)) 2529 } // reset map 2530 testUnmarshalErr(&v55v2, bs55, h, t, "dec-map-v55-p-len") 2531 testDeepEqualErr(v55v1, v55v2, t, "equal-map-v55-p-len") 2532 testReleaseBytes(bs55) 2533 bs55 = testMarshalErr(&v55v1, h, t, "enc-map-v55-p") 2534 v55v2 = nil 2535 testUnmarshalErr(&v55v2, bs55, h, t, "dec-map-v55-p-nil") 2536 testDeepEqualErr(v55v1, v55v2, t, "equal-map-v55-p-nil") 2537 testReleaseBytes(bs55) 2538 // ... 2539 if v == nil { 2540 v55v2 = nil 2541 } else { 2542 v55v2 = make(map[int]interface{}, len(v)) 2543 } // reset map 2544 var v55v3, v55v4 typMapMapIntIntf 2545 v55v3 = typMapMapIntIntf(v55v1) 2546 v55v4 = typMapMapIntIntf(v55v2) 2547 if v != nil { 2548 bs55 = testMarshalErr(v55v3, h, t, "enc-map-v55-custom") 2549 testUnmarshalErr(v55v4, bs55, h, t, "dec-map-v55-p-len") 2550 testDeepEqualErr(v55v3, v55v4, t, "equal-map-v55-p-len") 2551 testReleaseBytes(bs55) 2552 } 2553 } 2554 for _, v := range []map[int]string{nil, {}, {77: "", 127: "some-string-1"}} { 2555 // fmt.Printf(">>>> running mammoth map v56: %v\n", v) 2556 var v56v1, v56v2 map[int]string 2557 var bs56 []byte 2558 v56v1 = v 2559 bs56 = testMarshalErr(v56v1, h, t, "enc-map-v56") 2560 if v != nil { 2561 if v == nil { 2562 v56v2 = nil 2563 } else { 2564 v56v2 = make(map[int]string, len(v)) 2565 } // reset map 2566 testUnmarshalErr(v56v2, bs56, h, t, "dec-map-v56") 2567 testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56") 2568 if v == nil { 2569 v56v2 = nil 2570 } else { 2571 v56v2 = make(map[int]string, len(v)) 2572 } // reset map 2573 testUnmarshalErr(reflect.ValueOf(v56v2), bs56, h, t, "dec-map-v56-noaddr") // decode into non-addressable map value 2574 testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56-noaddr") 2575 } 2576 if v == nil { 2577 v56v2 = nil 2578 } else { 2579 v56v2 = make(map[int]string, len(v)) 2580 } // reset map 2581 testUnmarshalErr(&v56v2, bs56, h, t, "dec-map-v56-p-len") 2582 testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56-p-len") 2583 testReleaseBytes(bs56) 2584 bs56 = testMarshalErr(&v56v1, h, t, "enc-map-v56-p") 2585 v56v2 = nil 2586 testUnmarshalErr(&v56v2, bs56, h, t, "dec-map-v56-p-nil") 2587 testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56-p-nil") 2588 testReleaseBytes(bs56) 2589 // ... 2590 if v == nil { 2591 v56v2 = nil 2592 } else { 2593 v56v2 = make(map[int]string, len(v)) 2594 } // reset map 2595 var v56v3, v56v4 typMapMapIntString 2596 v56v3 = typMapMapIntString(v56v1) 2597 v56v4 = typMapMapIntString(v56v2) 2598 if v != nil { 2599 bs56 = testMarshalErr(v56v3, h, t, "enc-map-v56-custom") 2600 testUnmarshalErr(v56v4, bs56, h, t, "dec-map-v56-p-len") 2601 testDeepEqualErr(v56v3, v56v4, t, "equal-map-v56-p-len") 2602 testReleaseBytes(bs56) 2603 } 2604 } 2605 for _, v := range []map[int][]byte{nil, {}, {111: nil, 77: []byte("some-string-1")}} { 2606 // fmt.Printf(">>>> running mammoth map v57: %v\n", v) 2607 var v57v1, v57v2 map[int][]byte 2608 var bs57 []byte 2609 v57v1 = v 2610 bs57 = testMarshalErr(v57v1, h, t, "enc-map-v57") 2611 if v != nil { 2612 if v == nil { 2613 v57v2 = nil 2614 } else { 2615 v57v2 = make(map[int][]byte, len(v)) 2616 } // reset map 2617 testUnmarshalErr(v57v2, bs57, h, t, "dec-map-v57") 2618 testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57") 2619 if v == nil { 2620 v57v2 = nil 2621 } else { 2622 v57v2 = make(map[int][]byte, len(v)) 2623 } // reset map 2624 testUnmarshalErr(reflect.ValueOf(v57v2), bs57, h, t, "dec-map-v57-noaddr") // decode into non-addressable map value 2625 testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57-noaddr") 2626 } 2627 if v == nil { 2628 v57v2 = nil 2629 } else { 2630 v57v2 = make(map[int][]byte, len(v)) 2631 } // reset map 2632 testUnmarshalErr(&v57v2, bs57, h, t, "dec-map-v57-p-len") 2633 testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57-p-len") 2634 testReleaseBytes(bs57) 2635 bs57 = testMarshalErr(&v57v1, h, t, "enc-map-v57-p") 2636 v57v2 = nil 2637 testUnmarshalErr(&v57v2, bs57, h, t, "dec-map-v57-p-nil") 2638 testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57-p-nil") 2639 testReleaseBytes(bs57) 2640 // ... 2641 if v == nil { 2642 v57v2 = nil 2643 } else { 2644 v57v2 = make(map[int][]byte, len(v)) 2645 } // reset map 2646 var v57v3, v57v4 typMapMapIntBytes 2647 v57v3 = typMapMapIntBytes(v57v1) 2648 v57v4 = typMapMapIntBytes(v57v2) 2649 if v != nil { 2650 bs57 = testMarshalErr(v57v3, h, t, "enc-map-v57-custom") 2651 testUnmarshalErr(v57v4, bs57, h, t, "dec-map-v57-p-len") 2652 testDeepEqualErr(v57v3, v57v4, t, "equal-map-v57-p-len") 2653 testReleaseBytes(bs57) 2654 } 2655 } 2656 for _, v := range []map[int]uint8{nil, {}, {127: 0, 111: 77}} { 2657 // fmt.Printf(">>>> running mammoth map v58: %v\n", v) 2658 var v58v1, v58v2 map[int]uint8 2659 var bs58 []byte 2660 v58v1 = v 2661 bs58 = testMarshalErr(v58v1, h, t, "enc-map-v58") 2662 if v != nil { 2663 if v == nil { 2664 v58v2 = nil 2665 } else { 2666 v58v2 = make(map[int]uint8, len(v)) 2667 } // reset map 2668 testUnmarshalErr(v58v2, bs58, h, t, "dec-map-v58") 2669 testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58") 2670 if v == nil { 2671 v58v2 = nil 2672 } else { 2673 v58v2 = make(map[int]uint8, len(v)) 2674 } // reset map 2675 testUnmarshalErr(reflect.ValueOf(v58v2), bs58, h, t, "dec-map-v58-noaddr") // decode into non-addressable map value 2676 testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58-noaddr") 2677 } 2678 if v == nil { 2679 v58v2 = nil 2680 } else { 2681 v58v2 = make(map[int]uint8, len(v)) 2682 } // reset map 2683 testUnmarshalErr(&v58v2, bs58, h, t, "dec-map-v58-p-len") 2684 testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58-p-len") 2685 testReleaseBytes(bs58) 2686 bs58 = testMarshalErr(&v58v1, h, t, "enc-map-v58-p") 2687 v58v2 = nil 2688 testUnmarshalErr(&v58v2, bs58, h, t, "dec-map-v58-p-nil") 2689 testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58-p-nil") 2690 testReleaseBytes(bs58) 2691 // ... 2692 if v == nil { 2693 v58v2 = nil 2694 } else { 2695 v58v2 = make(map[int]uint8, len(v)) 2696 } // reset map 2697 var v58v3, v58v4 typMapMapIntUint8 2698 v58v3 = typMapMapIntUint8(v58v1) 2699 v58v4 = typMapMapIntUint8(v58v2) 2700 if v != nil { 2701 bs58 = testMarshalErr(v58v3, h, t, "enc-map-v58-custom") 2702 testUnmarshalErr(v58v4, bs58, h, t, "dec-map-v58-p-len") 2703 testDeepEqualErr(v58v3, v58v4, t, "equal-map-v58-p-len") 2704 testReleaseBytes(bs58) 2705 } 2706 } 2707 for _, v := range []map[int]uint64{nil, {}, {127: 0, 111: 77}} { 2708 // fmt.Printf(">>>> running mammoth map v59: %v\n", v) 2709 var v59v1, v59v2 map[int]uint64 2710 var bs59 []byte 2711 v59v1 = v 2712 bs59 = testMarshalErr(v59v1, h, t, "enc-map-v59") 2713 if v != nil { 2714 if v == nil { 2715 v59v2 = nil 2716 } else { 2717 v59v2 = make(map[int]uint64, len(v)) 2718 } // reset map 2719 testUnmarshalErr(v59v2, bs59, h, t, "dec-map-v59") 2720 testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59") 2721 if v == nil { 2722 v59v2 = nil 2723 } else { 2724 v59v2 = make(map[int]uint64, len(v)) 2725 } // reset map 2726 testUnmarshalErr(reflect.ValueOf(v59v2), bs59, h, t, "dec-map-v59-noaddr") // decode into non-addressable map value 2727 testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59-noaddr") 2728 } 2729 if v == nil { 2730 v59v2 = nil 2731 } else { 2732 v59v2 = make(map[int]uint64, len(v)) 2733 } // reset map 2734 testUnmarshalErr(&v59v2, bs59, h, t, "dec-map-v59-p-len") 2735 testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59-p-len") 2736 testReleaseBytes(bs59) 2737 bs59 = testMarshalErr(&v59v1, h, t, "enc-map-v59-p") 2738 v59v2 = nil 2739 testUnmarshalErr(&v59v2, bs59, h, t, "dec-map-v59-p-nil") 2740 testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59-p-nil") 2741 testReleaseBytes(bs59) 2742 // ... 2743 if v == nil { 2744 v59v2 = nil 2745 } else { 2746 v59v2 = make(map[int]uint64, len(v)) 2747 } // reset map 2748 var v59v3, v59v4 typMapMapIntUint64 2749 v59v3 = typMapMapIntUint64(v59v1) 2750 v59v4 = typMapMapIntUint64(v59v2) 2751 if v != nil { 2752 bs59 = testMarshalErr(v59v3, h, t, "enc-map-v59-custom") 2753 testUnmarshalErr(v59v4, bs59, h, t, "dec-map-v59-p-len") 2754 testDeepEqualErr(v59v3, v59v4, t, "equal-map-v59-p-len") 2755 testReleaseBytes(bs59) 2756 } 2757 } 2758 for _, v := range []map[int]int{nil, {}, {127: 0, 111: 77}} { 2759 // fmt.Printf(">>>> running mammoth map v60: %v\n", v) 2760 var v60v1, v60v2 map[int]int 2761 var bs60 []byte 2762 v60v1 = v 2763 bs60 = testMarshalErr(v60v1, h, t, "enc-map-v60") 2764 if v != nil { 2765 if v == nil { 2766 v60v2 = nil 2767 } else { 2768 v60v2 = make(map[int]int, len(v)) 2769 } // reset map 2770 testUnmarshalErr(v60v2, bs60, h, t, "dec-map-v60") 2771 testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60") 2772 if v == nil { 2773 v60v2 = nil 2774 } else { 2775 v60v2 = make(map[int]int, len(v)) 2776 } // reset map 2777 testUnmarshalErr(reflect.ValueOf(v60v2), bs60, h, t, "dec-map-v60-noaddr") // decode into non-addressable map value 2778 testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60-noaddr") 2779 } 2780 if v == nil { 2781 v60v2 = nil 2782 } else { 2783 v60v2 = make(map[int]int, len(v)) 2784 } // reset map 2785 testUnmarshalErr(&v60v2, bs60, h, t, "dec-map-v60-p-len") 2786 testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60-p-len") 2787 testReleaseBytes(bs60) 2788 bs60 = testMarshalErr(&v60v1, h, t, "enc-map-v60-p") 2789 v60v2 = nil 2790 testUnmarshalErr(&v60v2, bs60, h, t, "dec-map-v60-p-nil") 2791 testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60-p-nil") 2792 testReleaseBytes(bs60) 2793 // ... 2794 if v == nil { 2795 v60v2 = nil 2796 } else { 2797 v60v2 = make(map[int]int, len(v)) 2798 } // reset map 2799 var v60v3, v60v4 typMapMapIntInt 2800 v60v3 = typMapMapIntInt(v60v1) 2801 v60v4 = typMapMapIntInt(v60v2) 2802 if v != nil { 2803 bs60 = testMarshalErr(v60v3, h, t, "enc-map-v60-custom") 2804 testUnmarshalErr(v60v4, bs60, h, t, "dec-map-v60-p-len") 2805 testDeepEqualErr(v60v3, v60v4, t, "equal-map-v60-p-len") 2806 testReleaseBytes(bs60) 2807 } 2808 } 2809 for _, v := range []map[int]int32{nil, {}, {127: 0, 111: 77}} { 2810 // fmt.Printf(">>>> running mammoth map v61: %v\n", v) 2811 var v61v1, v61v2 map[int]int32 2812 var bs61 []byte 2813 v61v1 = v 2814 bs61 = testMarshalErr(v61v1, h, t, "enc-map-v61") 2815 if v != nil { 2816 if v == nil { 2817 v61v2 = nil 2818 } else { 2819 v61v2 = make(map[int]int32, len(v)) 2820 } // reset map 2821 testUnmarshalErr(v61v2, bs61, h, t, "dec-map-v61") 2822 testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61") 2823 if v == nil { 2824 v61v2 = nil 2825 } else { 2826 v61v2 = make(map[int]int32, len(v)) 2827 } // reset map 2828 testUnmarshalErr(reflect.ValueOf(v61v2), bs61, h, t, "dec-map-v61-noaddr") // decode into non-addressable map value 2829 testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61-noaddr") 2830 } 2831 if v == nil { 2832 v61v2 = nil 2833 } else { 2834 v61v2 = make(map[int]int32, len(v)) 2835 } // reset map 2836 testUnmarshalErr(&v61v2, bs61, h, t, "dec-map-v61-p-len") 2837 testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61-p-len") 2838 testReleaseBytes(bs61) 2839 bs61 = testMarshalErr(&v61v1, h, t, "enc-map-v61-p") 2840 v61v2 = nil 2841 testUnmarshalErr(&v61v2, bs61, h, t, "dec-map-v61-p-nil") 2842 testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61-p-nil") 2843 testReleaseBytes(bs61) 2844 // ... 2845 if v == nil { 2846 v61v2 = nil 2847 } else { 2848 v61v2 = make(map[int]int32, len(v)) 2849 } // reset map 2850 var v61v3, v61v4 typMapMapIntInt32 2851 v61v3 = typMapMapIntInt32(v61v1) 2852 v61v4 = typMapMapIntInt32(v61v2) 2853 if v != nil { 2854 bs61 = testMarshalErr(v61v3, h, t, "enc-map-v61-custom") 2855 testUnmarshalErr(v61v4, bs61, h, t, "dec-map-v61-p-len") 2856 testDeepEqualErr(v61v3, v61v4, t, "equal-map-v61-p-len") 2857 testReleaseBytes(bs61) 2858 } 2859 } 2860 for _, v := range []map[int]float64{nil, {}, {127: 0, 111: 33.3e3}} { 2861 // fmt.Printf(">>>> running mammoth map v62: %v\n", v) 2862 var v62v1, v62v2 map[int]float64 2863 var bs62 []byte 2864 v62v1 = v 2865 bs62 = testMarshalErr(v62v1, h, t, "enc-map-v62") 2866 if v != nil { 2867 if v == nil { 2868 v62v2 = nil 2869 } else { 2870 v62v2 = make(map[int]float64, len(v)) 2871 } // reset map 2872 testUnmarshalErr(v62v2, bs62, h, t, "dec-map-v62") 2873 testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62") 2874 if v == nil { 2875 v62v2 = nil 2876 } else { 2877 v62v2 = make(map[int]float64, len(v)) 2878 } // reset map 2879 testUnmarshalErr(reflect.ValueOf(v62v2), bs62, h, t, "dec-map-v62-noaddr") // decode into non-addressable map value 2880 testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62-noaddr") 2881 } 2882 if v == nil { 2883 v62v2 = nil 2884 } else { 2885 v62v2 = make(map[int]float64, len(v)) 2886 } // reset map 2887 testUnmarshalErr(&v62v2, bs62, h, t, "dec-map-v62-p-len") 2888 testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62-p-len") 2889 testReleaseBytes(bs62) 2890 bs62 = testMarshalErr(&v62v1, h, t, "enc-map-v62-p") 2891 v62v2 = nil 2892 testUnmarshalErr(&v62v2, bs62, h, t, "dec-map-v62-p-nil") 2893 testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62-p-nil") 2894 testReleaseBytes(bs62) 2895 // ... 2896 if v == nil { 2897 v62v2 = nil 2898 } else { 2899 v62v2 = make(map[int]float64, len(v)) 2900 } // reset map 2901 var v62v3, v62v4 typMapMapIntFloat64 2902 v62v3 = typMapMapIntFloat64(v62v1) 2903 v62v4 = typMapMapIntFloat64(v62v2) 2904 if v != nil { 2905 bs62 = testMarshalErr(v62v3, h, t, "enc-map-v62-custom") 2906 testUnmarshalErr(v62v4, bs62, h, t, "dec-map-v62-p-len") 2907 testDeepEqualErr(v62v3, v62v4, t, "equal-map-v62-p-len") 2908 testReleaseBytes(bs62) 2909 } 2910 } 2911 for _, v := range []map[int]bool{nil, {}, {77: false, 127: true}} { 2912 // fmt.Printf(">>>> running mammoth map v63: %v\n", v) 2913 var v63v1, v63v2 map[int]bool 2914 var bs63 []byte 2915 v63v1 = v 2916 bs63 = testMarshalErr(v63v1, h, t, "enc-map-v63") 2917 if v != nil { 2918 if v == nil { 2919 v63v2 = nil 2920 } else { 2921 v63v2 = make(map[int]bool, len(v)) 2922 } // reset map 2923 testUnmarshalErr(v63v2, bs63, h, t, "dec-map-v63") 2924 testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63") 2925 if v == nil { 2926 v63v2 = nil 2927 } else { 2928 v63v2 = make(map[int]bool, len(v)) 2929 } // reset map 2930 testUnmarshalErr(reflect.ValueOf(v63v2), bs63, h, t, "dec-map-v63-noaddr") // decode into non-addressable map value 2931 testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63-noaddr") 2932 } 2933 if v == nil { 2934 v63v2 = nil 2935 } else { 2936 v63v2 = make(map[int]bool, len(v)) 2937 } // reset map 2938 testUnmarshalErr(&v63v2, bs63, h, t, "dec-map-v63-p-len") 2939 testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63-p-len") 2940 testReleaseBytes(bs63) 2941 bs63 = testMarshalErr(&v63v1, h, t, "enc-map-v63-p") 2942 v63v2 = nil 2943 testUnmarshalErr(&v63v2, bs63, h, t, "dec-map-v63-p-nil") 2944 testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63-p-nil") 2945 testReleaseBytes(bs63) 2946 // ... 2947 if v == nil { 2948 v63v2 = nil 2949 } else { 2950 v63v2 = make(map[int]bool, len(v)) 2951 } // reset map 2952 var v63v3, v63v4 typMapMapIntBool 2953 v63v3 = typMapMapIntBool(v63v1) 2954 v63v4 = typMapMapIntBool(v63v2) 2955 if v != nil { 2956 bs63 = testMarshalErr(v63v3, h, t, "enc-map-v63-custom") 2957 testUnmarshalErr(v63v4, bs63, h, t, "dec-map-v63-p-len") 2958 testDeepEqualErr(v63v3, v63v4, t, "equal-map-v63-p-len") 2959 testReleaseBytes(bs63) 2960 } 2961 } 2962 for _, v := range []map[int32]interface{}{nil, {}, {111: nil, 77: "string-is-an-interface-2"}} { 2963 // fmt.Printf(">>>> running mammoth map v64: %v\n", v) 2964 var v64v1, v64v2 map[int32]interface{} 2965 var bs64 []byte 2966 v64v1 = v 2967 bs64 = testMarshalErr(v64v1, h, t, "enc-map-v64") 2968 if v != nil { 2969 if v == nil { 2970 v64v2 = nil 2971 } else { 2972 v64v2 = make(map[int32]interface{}, len(v)) 2973 } // reset map 2974 testUnmarshalErr(v64v2, bs64, h, t, "dec-map-v64") 2975 testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64") 2976 if v == nil { 2977 v64v2 = nil 2978 } else { 2979 v64v2 = make(map[int32]interface{}, len(v)) 2980 } // reset map 2981 testUnmarshalErr(reflect.ValueOf(v64v2), bs64, h, t, "dec-map-v64-noaddr") // decode into non-addressable map value 2982 testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64-noaddr") 2983 } 2984 if v == nil { 2985 v64v2 = nil 2986 } else { 2987 v64v2 = make(map[int32]interface{}, len(v)) 2988 } // reset map 2989 testUnmarshalErr(&v64v2, bs64, h, t, "dec-map-v64-p-len") 2990 testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64-p-len") 2991 testReleaseBytes(bs64) 2992 bs64 = testMarshalErr(&v64v1, h, t, "enc-map-v64-p") 2993 v64v2 = nil 2994 testUnmarshalErr(&v64v2, bs64, h, t, "dec-map-v64-p-nil") 2995 testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64-p-nil") 2996 testReleaseBytes(bs64) 2997 // ... 2998 if v == nil { 2999 v64v2 = nil 3000 } else { 3001 v64v2 = make(map[int32]interface{}, len(v)) 3002 } // reset map 3003 var v64v3, v64v4 typMapMapInt32Intf 3004 v64v3 = typMapMapInt32Intf(v64v1) 3005 v64v4 = typMapMapInt32Intf(v64v2) 3006 if v != nil { 3007 bs64 = testMarshalErr(v64v3, h, t, "enc-map-v64-custom") 3008 testUnmarshalErr(v64v4, bs64, h, t, "dec-map-v64-p-len") 3009 testDeepEqualErr(v64v3, v64v4, t, "equal-map-v64-p-len") 3010 testReleaseBytes(bs64) 3011 } 3012 } 3013 for _, v := range []map[int32]string{nil, {}, {127: "", 111: "some-string-2"}} { 3014 // fmt.Printf(">>>> running mammoth map v65: %v\n", v) 3015 var v65v1, v65v2 map[int32]string 3016 var bs65 []byte 3017 v65v1 = v 3018 bs65 = testMarshalErr(v65v1, h, t, "enc-map-v65") 3019 if v != nil { 3020 if v == nil { 3021 v65v2 = nil 3022 } else { 3023 v65v2 = make(map[int32]string, len(v)) 3024 } // reset map 3025 testUnmarshalErr(v65v2, bs65, h, t, "dec-map-v65") 3026 testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65") 3027 if v == nil { 3028 v65v2 = nil 3029 } else { 3030 v65v2 = make(map[int32]string, len(v)) 3031 } // reset map 3032 testUnmarshalErr(reflect.ValueOf(v65v2), bs65, h, t, "dec-map-v65-noaddr") // decode into non-addressable map value 3033 testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65-noaddr") 3034 } 3035 if v == nil { 3036 v65v2 = nil 3037 } else { 3038 v65v2 = make(map[int32]string, len(v)) 3039 } // reset map 3040 testUnmarshalErr(&v65v2, bs65, h, t, "dec-map-v65-p-len") 3041 testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65-p-len") 3042 testReleaseBytes(bs65) 3043 bs65 = testMarshalErr(&v65v1, h, t, "enc-map-v65-p") 3044 v65v2 = nil 3045 testUnmarshalErr(&v65v2, bs65, h, t, "dec-map-v65-p-nil") 3046 testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65-p-nil") 3047 testReleaseBytes(bs65) 3048 // ... 3049 if v == nil { 3050 v65v2 = nil 3051 } else { 3052 v65v2 = make(map[int32]string, len(v)) 3053 } // reset map 3054 var v65v3, v65v4 typMapMapInt32String 3055 v65v3 = typMapMapInt32String(v65v1) 3056 v65v4 = typMapMapInt32String(v65v2) 3057 if v != nil { 3058 bs65 = testMarshalErr(v65v3, h, t, "enc-map-v65-custom") 3059 testUnmarshalErr(v65v4, bs65, h, t, "dec-map-v65-p-len") 3060 testDeepEqualErr(v65v3, v65v4, t, "equal-map-v65-p-len") 3061 testReleaseBytes(bs65) 3062 } 3063 } 3064 for _, v := range []map[int32][]byte{nil, {}, {77: nil, 127: []byte("some-string-2")}} { 3065 // fmt.Printf(">>>> running mammoth map v66: %v\n", v) 3066 var v66v1, v66v2 map[int32][]byte 3067 var bs66 []byte 3068 v66v1 = v 3069 bs66 = testMarshalErr(v66v1, h, t, "enc-map-v66") 3070 if v != nil { 3071 if v == nil { 3072 v66v2 = nil 3073 } else { 3074 v66v2 = make(map[int32][]byte, len(v)) 3075 } // reset map 3076 testUnmarshalErr(v66v2, bs66, h, t, "dec-map-v66") 3077 testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66") 3078 if v == nil { 3079 v66v2 = nil 3080 } else { 3081 v66v2 = make(map[int32][]byte, len(v)) 3082 } // reset map 3083 testUnmarshalErr(reflect.ValueOf(v66v2), bs66, h, t, "dec-map-v66-noaddr") // decode into non-addressable map value 3084 testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66-noaddr") 3085 } 3086 if v == nil { 3087 v66v2 = nil 3088 } else { 3089 v66v2 = make(map[int32][]byte, len(v)) 3090 } // reset map 3091 testUnmarshalErr(&v66v2, bs66, h, t, "dec-map-v66-p-len") 3092 testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66-p-len") 3093 testReleaseBytes(bs66) 3094 bs66 = testMarshalErr(&v66v1, h, t, "enc-map-v66-p") 3095 v66v2 = nil 3096 testUnmarshalErr(&v66v2, bs66, h, t, "dec-map-v66-p-nil") 3097 testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66-p-nil") 3098 testReleaseBytes(bs66) 3099 // ... 3100 if v == nil { 3101 v66v2 = nil 3102 } else { 3103 v66v2 = make(map[int32][]byte, len(v)) 3104 } // reset map 3105 var v66v3, v66v4 typMapMapInt32Bytes 3106 v66v3 = typMapMapInt32Bytes(v66v1) 3107 v66v4 = typMapMapInt32Bytes(v66v2) 3108 if v != nil { 3109 bs66 = testMarshalErr(v66v3, h, t, "enc-map-v66-custom") 3110 testUnmarshalErr(v66v4, bs66, h, t, "dec-map-v66-p-len") 3111 testDeepEqualErr(v66v3, v66v4, t, "equal-map-v66-p-len") 3112 testReleaseBytes(bs66) 3113 } 3114 } 3115 for _, v := range []map[int32]uint8{nil, {}, {111: 0, 77: 127}} { 3116 // fmt.Printf(">>>> running mammoth map v67: %v\n", v) 3117 var v67v1, v67v2 map[int32]uint8 3118 var bs67 []byte 3119 v67v1 = v 3120 bs67 = testMarshalErr(v67v1, h, t, "enc-map-v67") 3121 if v != nil { 3122 if v == nil { 3123 v67v2 = nil 3124 } else { 3125 v67v2 = make(map[int32]uint8, len(v)) 3126 } // reset map 3127 testUnmarshalErr(v67v2, bs67, h, t, "dec-map-v67") 3128 testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67") 3129 if v == nil { 3130 v67v2 = nil 3131 } else { 3132 v67v2 = make(map[int32]uint8, len(v)) 3133 } // reset map 3134 testUnmarshalErr(reflect.ValueOf(v67v2), bs67, h, t, "dec-map-v67-noaddr") // decode into non-addressable map value 3135 testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67-noaddr") 3136 } 3137 if v == nil { 3138 v67v2 = nil 3139 } else { 3140 v67v2 = make(map[int32]uint8, len(v)) 3141 } // reset map 3142 testUnmarshalErr(&v67v2, bs67, h, t, "dec-map-v67-p-len") 3143 testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67-p-len") 3144 testReleaseBytes(bs67) 3145 bs67 = testMarshalErr(&v67v1, h, t, "enc-map-v67-p") 3146 v67v2 = nil 3147 testUnmarshalErr(&v67v2, bs67, h, t, "dec-map-v67-p-nil") 3148 testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67-p-nil") 3149 testReleaseBytes(bs67) 3150 // ... 3151 if v == nil { 3152 v67v2 = nil 3153 } else { 3154 v67v2 = make(map[int32]uint8, len(v)) 3155 } // reset map 3156 var v67v3, v67v4 typMapMapInt32Uint8 3157 v67v3 = typMapMapInt32Uint8(v67v1) 3158 v67v4 = typMapMapInt32Uint8(v67v2) 3159 if v != nil { 3160 bs67 = testMarshalErr(v67v3, h, t, "enc-map-v67-custom") 3161 testUnmarshalErr(v67v4, bs67, h, t, "dec-map-v67-p-len") 3162 testDeepEqualErr(v67v3, v67v4, t, "equal-map-v67-p-len") 3163 testReleaseBytes(bs67) 3164 } 3165 } 3166 for _, v := range []map[int32]uint64{nil, {}, {111: 0, 77: 127}} { 3167 // fmt.Printf(">>>> running mammoth map v68: %v\n", v) 3168 var v68v1, v68v2 map[int32]uint64 3169 var bs68 []byte 3170 v68v1 = v 3171 bs68 = testMarshalErr(v68v1, h, t, "enc-map-v68") 3172 if v != nil { 3173 if v == nil { 3174 v68v2 = nil 3175 } else { 3176 v68v2 = make(map[int32]uint64, len(v)) 3177 } // reset map 3178 testUnmarshalErr(v68v2, bs68, h, t, "dec-map-v68") 3179 testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68") 3180 if v == nil { 3181 v68v2 = nil 3182 } else { 3183 v68v2 = make(map[int32]uint64, len(v)) 3184 } // reset map 3185 testUnmarshalErr(reflect.ValueOf(v68v2), bs68, h, t, "dec-map-v68-noaddr") // decode into non-addressable map value 3186 testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68-noaddr") 3187 } 3188 if v == nil { 3189 v68v2 = nil 3190 } else { 3191 v68v2 = make(map[int32]uint64, len(v)) 3192 } // reset map 3193 testUnmarshalErr(&v68v2, bs68, h, t, "dec-map-v68-p-len") 3194 testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68-p-len") 3195 testReleaseBytes(bs68) 3196 bs68 = testMarshalErr(&v68v1, h, t, "enc-map-v68-p") 3197 v68v2 = nil 3198 testUnmarshalErr(&v68v2, bs68, h, t, "dec-map-v68-p-nil") 3199 testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68-p-nil") 3200 testReleaseBytes(bs68) 3201 // ... 3202 if v == nil { 3203 v68v2 = nil 3204 } else { 3205 v68v2 = make(map[int32]uint64, len(v)) 3206 } // reset map 3207 var v68v3, v68v4 typMapMapInt32Uint64 3208 v68v3 = typMapMapInt32Uint64(v68v1) 3209 v68v4 = typMapMapInt32Uint64(v68v2) 3210 if v != nil { 3211 bs68 = testMarshalErr(v68v3, h, t, "enc-map-v68-custom") 3212 testUnmarshalErr(v68v4, bs68, h, t, "dec-map-v68-p-len") 3213 testDeepEqualErr(v68v3, v68v4, t, "equal-map-v68-p-len") 3214 testReleaseBytes(bs68) 3215 } 3216 } 3217 for _, v := range []map[int32]int{nil, {}, {111: 0, 77: 127}} { 3218 // fmt.Printf(">>>> running mammoth map v69: %v\n", v) 3219 var v69v1, v69v2 map[int32]int 3220 var bs69 []byte 3221 v69v1 = v 3222 bs69 = testMarshalErr(v69v1, h, t, "enc-map-v69") 3223 if v != nil { 3224 if v == nil { 3225 v69v2 = nil 3226 } else { 3227 v69v2 = make(map[int32]int, len(v)) 3228 } // reset map 3229 testUnmarshalErr(v69v2, bs69, h, t, "dec-map-v69") 3230 testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69") 3231 if v == nil { 3232 v69v2 = nil 3233 } else { 3234 v69v2 = make(map[int32]int, len(v)) 3235 } // reset map 3236 testUnmarshalErr(reflect.ValueOf(v69v2), bs69, h, t, "dec-map-v69-noaddr") // decode into non-addressable map value 3237 testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69-noaddr") 3238 } 3239 if v == nil { 3240 v69v2 = nil 3241 } else { 3242 v69v2 = make(map[int32]int, len(v)) 3243 } // reset map 3244 testUnmarshalErr(&v69v2, bs69, h, t, "dec-map-v69-p-len") 3245 testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69-p-len") 3246 testReleaseBytes(bs69) 3247 bs69 = testMarshalErr(&v69v1, h, t, "enc-map-v69-p") 3248 v69v2 = nil 3249 testUnmarshalErr(&v69v2, bs69, h, t, "dec-map-v69-p-nil") 3250 testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69-p-nil") 3251 testReleaseBytes(bs69) 3252 // ... 3253 if v == nil { 3254 v69v2 = nil 3255 } else { 3256 v69v2 = make(map[int32]int, len(v)) 3257 } // reset map 3258 var v69v3, v69v4 typMapMapInt32Int 3259 v69v3 = typMapMapInt32Int(v69v1) 3260 v69v4 = typMapMapInt32Int(v69v2) 3261 if v != nil { 3262 bs69 = testMarshalErr(v69v3, h, t, "enc-map-v69-custom") 3263 testUnmarshalErr(v69v4, bs69, h, t, "dec-map-v69-p-len") 3264 testDeepEqualErr(v69v3, v69v4, t, "equal-map-v69-p-len") 3265 testReleaseBytes(bs69) 3266 } 3267 } 3268 for _, v := range []map[int32]int32{nil, {}, {111: 0, 77: 127}} { 3269 // fmt.Printf(">>>> running mammoth map v70: %v\n", v) 3270 var v70v1, v70v2 map[int32]int32 3271 var bs70 []byte 3272 v70v1 = v 3273 bs70 = testMarshalErr(v70v1, h, t, "enc-map-v70") 3274 if v != nil { 3275 if v == nil { 3276 v70v2 = nil 3277 } else { 3278 v70v2 = make(map[int32]int32, len(v)) 3279 } // reset map 3280 testUnmarshalErr(v70v2, bs70, h, t, "dec-map-v70") 3281 testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70") 3282 if v == nil { 3283 v70v2 = nil 3284 } else { 3285 v70v2 = make(map[int32]int32, len(v)) 3286 } // reset map 3287 testUnmarshalErr(reflect.ValueOf(v70v2), bs70, h, t, "dec-map-v70-noaddr") // decode into non-addressable map value 3288 testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70-noaddr") 3289 } 3290 if v == nil { 3291 v70v2 = nil 3292 } else { 3293 v70v2 = make(map[int32]int32, len(v)) 3294 } // reset map 3295 testUnmarshalErr(&v70v2, bs70, h, t, "dec-map-v70-p-len") 3296 testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70-p-len") 3297 testReleaseBytes(bs70) 3298 bs70 = testMarshalErr(&v70v1, h, t, "enc-map-v70-p") 3299 v70v2 = nil 3300 testUnmarshalErr(&v70v2, bs70, h, t, "dec-map-v70-p-nil") 3301 testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70-p-nil") 3302 testReleaseBytes(bs70) 3303 // ... 3304 if v == nil { 3305 v70v2 = nil 3306 } else { 3307 v70v2 = make(map[int32]int32, len(v)) 3308 } // reset map 3309 var v70v3, v70v4 typMapMapInt32Int32 3310 v70v3 = typMapMapInt32Int32(v70v1) 3311 v70v4 = typMapMapInt32Int32(v70v2) 3312 if v != nil { 3313 bs70 = testMarshalErr(v70v3, h, t, "enc-map-v70-custom") 3314 testUnmarshalErr(v70v4, bs70, h, t, "dec-map-v70-p-len") 3315 testDeepEqualErr(v70v3, v70v4, t, "equal-map-v70-p-len") 3316 testReleaseBytes(bs70) 3317 } 3318 } 3319 for _, v := range []map[int32]float64{nil, {}, {111: 0, 77: 11.1}} { 3320 // fmt.Printf(">>>> running mammoth map v71: %v\n", v) 3321 var v71v1, v71v2 map[int32]float64 3322 var bs71 []byte 3323 v71v1 = v 3324 bs71 = testMarshalErr(v71v1, h, t, "enc-map-v71") 3325 if v != nil { 3326 if v == nil { 3327 v71v2 = nil 3328 } else { 3329 v71v2 = make(map[int32]float64, len(v)) 3330 } // reset map 3331 testUnmarshalErr(v71v2, bs71, h, t, "dec-map-v71") 3332 testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71") 3333 if v == nil { 3334 v71v2 = nil 3335 } else { 3336 v71v2 = make(map[int32]float64, len(v)) 3337 } // reset map 3338 testUnmarshalErr(reflect.ValueOf(v71v2), bs71, h, t, "dec-map-v71-noaddr") // decode into non-addressable map value 3339 testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71-noaddr") 3340 } 3341 if v == nil { 3342 v71v2 = nil 3343 } else { 3344 v71v2 = make(map[int32]float64, len(v)) 3345 } // reset map 3346 testUnmarshalErr(&v71v2, bs71, h, t, "dec-map-v71-p-len") 3347 testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71-p-len") 3348 testReleaseBytes(bs71) 3349 bs71 = testMarshalErr(&v71v1, h, t, "enc-map-v71-p") 3350 v71v2 = nil 3351 testUnmarshalErr(&v71v2, bs71, h, t, "dec-map-v71-p-nil") 3352 testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71-p-nil") 3353 testReleaseBytes(bs71) 3354 // ... 3355 if v == nil { 3356 v71v2 = nil 3357 } else { 3358 v71v2 = make(map[int32]float64, len(v)) 3359 } // reset map 3360 var v71v3, v71v4 typMapMapInt32Float64 3361 v71v3 = typMapMapInt32Float64(v71v1) 3362 v71v4 = typMapMapInt32Float64(v71v2) 3363 if v != nil { 3364 bs71 = testMarshalErr(v71v3, h, t, "enc-map-v71-custom") 3365 testUnmarshalErr(v71v4, bs71, h, t, "dec-map-v71-p-len") 3366 testDeepEqualErr(v71v3, v71v4, t, "equal-map-v71-p-len") 3367 testReleaseBytes(bs71) 3368 } 3369 } 3370 for _, v := range []map[int32]bool{nil, {}, {127: false, 111: false}} { 3371 // fmt.Printf(">>>> running mammoth map v72: %v\n", v) 3372 var v72v1, v72v2 map[int32]bool 3373 var bs72 []byte 3374 v72v1 = v 3375 bs72 = testMarshalErr(v72v1, h, t, "enc-map-v72") 3376 if v != nil { 3377 if v == nil { 3378 v72v2 = nil 3379 } else { 3380 v72v2 = make(map[int32]bool, len(v)) 3381 } // reset map 3382 testUnmarshalErr(v72v2, bs72, h, t, "dec-map-v72") 3383 testDeepEqualErr(v72v1, v72v2, t, "equal-map-v72") 3384 if v == nil { 3385 v72v2 = nil 3386 } else { 3387 v72v2 = make(map[int32]bool, len(v)) 3388 } // reset map 3389 testUnmarshalErr(reflect.ValueOf(v72v2), bs72, h, t, "dec-map-v72-noaddr") // decode into non-addressable map value 3390 testDeepEqualErr(v72v1, v72v2, t, "equal-map-v72-noaddr") 3391 } 3392 if v == nil { 3393 v72v2 = nil 3394 } else { 3395 v72v2 = make(map[int32]bool, len(v)) 3396 } // reset map 3397 testUnmarshalErr(&v72v2, bs72, h, t, "dec-map-v72-p-len") 3398 testDeepEqualErr(v72v1, v72v2, t, "equal-map-v72-p-len") 3399 testReleaseBytes(bs72) 3400 bs72 = testMarshalErr(&v72v1, h, t, "enc-map-v72-p") 3401 v72v2 = nil 3402 testUnmarshalErr(&v72v2, bs72, h, t, "dec-map-v72-p-nil") 3403 testDeepEqualErr(v72v1, v72v2, t, "equal-map-v72-p-nil") 3404 testReleaseBytes(bs72) 3405 // ... 3406 if v == nil { 3407 v72v2 = nil 3408 } else { 3409 v72v2 = make(map[int32]bool, len(v)) 3410 } // reset map 3411 var v72v3, v72v4 typMapMapInt32Bool 3412 v72v3 = typMapMapInt32Bool(v72v1) 3413 v72v4 = typMapMapInt32Bool(v72v2) 3414 if v != nil { 3415 bs72 = testMarshalErr(v72v3, h, t, "enc-map-v72-custom") 3416 testUnmarshalErr(v72v4, bs72, h, t, "dec-map-v72-p-len") 3417 testDeepEqualErr(v72v3, v72v4, t, "equal-map-v72-p-len") 3418 testReleaseBytes(bs72) 3419 } 3420 } 3421 3422 } 3423 3424 func doTestMammothMapsAndSlices(t *testing.T, h Handle) { 3425 defer testSetup(t, &h)() 3426 if mh, ok := h.(*MsgpackHandle); ok { 3427 defer func(b bool) { mh.RawToString = b }(mh.RawToString) 3428 mh.RawToString = true 3429 } 3430 __doTestMammothSlices(t, h) 3431 __doTestMammothMaps(t, h) 3432 } 3433 3434 func doTestMammoth(t *testing.T, h Handle) { 3435 defer testSetup(t, &h)() 3436 if mh, ok := h.(*MsgpackHandle); ok { 3437 defer func(b bool) { mh.RawToString = b }(mh.RawToString) 3438 mh.RawToString = true 3439 } 3440 3441 name := h.Name() 3442 var b []byte 3443 3444 var m, m2 TestMammoth 3445 testRandomFillRV(reflect.ValueOf(&m).Elem()) 3446 b = testMarshalErr(&m, h, t, "mammoth-"+name) 3447 3448 testUnmarshalErr(&m2, b, h, t, "mammoth-"+name) 3449 testDeepEqualErr(&m, &m2, t, "mammoth-"+name) 3450 testReleaseBytes(b) 3451 3452 if testing.Short() { 3453 t.Skipf("skipping rest of mammoth test in -short mode") 3454 } 3455 3456 var mm, mm2 TestMammoth2Wrapper 3457 testRandomFillRV(reflect.ValueOf(&mm).Elem()) 3458 b = testMarshalErr(&mm, h, t, "mammoth2-"+name) 3459 // os.Stderr.Write([]byte("\n\n\n\n" + string(b) + "\n\n\n\n")) 3460 testUnmarshalErr(&mm2, b, h, t, "mammoth2-"+name) 3461 testDeepEqualErr(&mm, &mm2, t, "mammoth2-"+name) 3462 // testMammoth2(t, name, h) 3463 testReleaseBytes(b) 3464 } 3465 3466 func TestJsonMammoth(t *testing.T) { 3467 doTestMammoth(t, testJsonH) 3468 } 3469 func TestCborMammoth(t *testing.T) { 3470 doTestMammoth(t, testCborH) 3471 } 3472 func TestMsgpackMammoth(t *testing.T) { 3473 doTestMammoth(t, testMsgpackH) 3474 } 3475 func TestBincMammoth(t *testing.T) { 3476 doTestMammoth(t, testBincH) 3477 } 3478 func TestSimpleMammoth(t *testing.T) { 3479 doTestMammoth(t, testSimpleH) 3480 } 3481 3482 func TestJsonMammothMapsAndSlices(t *testing.T) { 3483 doTestMammothMapsAndSlices(t, testJsonH) 3484 } 3485 func TestCborMammothMapsAndSlices(t *testing.T) { 3486 doTestMammothMapsAndSlices(t, testCborH) 3487 } 3488 func TestMsgpackMammothMapsAndSlices(t *testing.T) { 3489 doTestMammothMapsAndSlices(t, testMsgpackH) 3490 } 3491 func TestBincMammothMapsAndSlices(t *testing.T) { 3492 doTestMammothMapsAndSlices(t, testBincH) 3493 } 3494 func TestSimpleMammothMapsAndSlices(t *testing.T) { 3495 doTestMammothMapsAndSlices(t, testSimpleH) 3496 }