| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
package codec |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
import ( |
| 32 |
"testing" |
| 33 |
"time" |
| 34 |
) |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
type testTimeTracker struct { |
| 44 |
t time.Time |
| 45 |
} |
| 46 |
|
| 47 |
func (tt *testTimeTracker) Elapsed() (d time.Duration) { |
| 48 |
if !tt.t.IsZero() { |
| 49 |
d = time.Since(tt.t) |
| 50 |
} |
| 51 |
tt.t = time.Now() |
| 52 |
return |
| 53 |
} |
| 54 |
|
| 55 |
func testGroupResetFlags() { |
| 56 |
testRpcBufsize = 2048 |
| 57 |
testUseIoEncDec = -1 |
| 58 |
testUseReset = false |
| 59 |
testUseParallel = false |
| 60 |
testMaxInitLen = 0 |
| 61 |
testUseIoWrapper = false |
| 62 |
testNumRepeatString = 8 |
| 63 |
testDepth = 0 |
| 64 |
testDecodeOptions = DecodeOptions{} |
| 65 |
testEncodeOptions = EncodeOptions{} |
| 66 |
|
| 67 |
testJsonH.Indent = 0 |
| 68 |
testJsonH.HTMLCharsAsIs = false |
| 69 |
testJsonH.MapKeyAsString = false |
| 70 |
testJsonH.PreferFloat = false |
| 71 |
|
| 72 |
testCborH.IndefiniteLength = false |
| 73 |
testCborH.TimeRFC3339 = false |
| 74 |
testCborH.SkipUnexpectedTags = false |
| 75 |
testBincH.AsSymbols = 0 |
| 76 |
|
| 77 |
testMsgpackH.WriteExt = false |
| 78 |
testMsgpackH.NoFixedNum = false |
| 79 |
testMsgpackH.PositiveIntUnsigned = false |
| 80 |
|
| 81 |
testSimpleH.EncZeroValuesAsNil = false |
| 82 |
} |
| 83 |
|
| 84 |
func testCodecGroup(t *testing.T) { |
| 85 |
|
| 86 |
testJsonGroup(t) |
| 87 |
testBincGroup(t) |
| 88 |
testCborGroup(t) |
| 89 |
testMsgpackGroup(t) |
| 90 |
testSimpleGroup(t) |
| 91 |
|
| 92 |
|
| 93 |
testNonHandlesGroup(t) |
| 94 |
|
| 95 |
testCodecGroupV(t) |
| 96 |
|
| 97 |
} |
| 98 |
|
| 99 |
func testCodecGroupV(t *testing.T) { |
| 100 |
testJsonGroupV(t) |
| 101 |
testBincGroupV(t) |
| 102 |
testCborGroupV(t) |
| 103 |
testMsgpackGroupV(t) |
| 104 |
testSimpleGroupV(t) |
| 105 |
} |
| 106 |
|
| 107 |
func testJsonGroup(t *testing.T) { |
| 108 |
t.Run("TestJsonCodecsEmbeddedPointer", TestJsonCodecsEmbeddedPointer) |
| 109 |
t.Run("TestJsonCodecChan", TestJsonCodecChan) |
| 110 |
t.Run("TestJsonStdEncIntf", TestJsonStdEncIntf) |
| 111 |
t.Run("TestJsonMammoth", TestJsonMammoth) |
| 112 |
t.Run("TestJsonRaw", TestJsonRaw) |
| 113 |
t.Run("TestJsonRpcGo", TestJsonRpcGo) |
| 114 |
t.Run("TestJsonLargeInteger", TestJsonLargeInteger) |
| 115 |
t.Run("TestJsonDecodeNonStringScalarInStringContext", TestJsonDecodeNonStringScalarInStringContext) |
| 116 |
t.Run("TestJsonEncodeIndent", TestJsonEncodeIndent) |
| 117 |
|
| 118 |
t.Run("TestJsonRawExt", TestJsonRawExt) |
| 119 |
t.Run("TestJsonMapStructKey", TestJsonMapStructKey) |
| 120 |
t.Run("TestJsonDecodeNilMapValue", TestJsonDecodeNilMapValue) |
| 121 |
t.Run("TestJsonEmbeddedFieldPrecedence", TestJsonEmbeddedFieldPrecedence) |
| 122 |
t.Run("TestJsonLargeContainerLen", TestJsonLargeContainerLen) |
| 123 |
t.Run("TestJsonMammothMapsAndSlices", TestJsonMammothMapsAndSlices) |
| 124 |
t.Run("TestJsonTime", TestJsonTime) |
| 125 |
t.Run("TestJsonUintToInt", TestJsonUintToInt) |
| 126 |
t.Run("TestJsonDifferentMapOrSliceType", TestJsonDifferentMapOrSliceType) |
| 127 |
t.Run("TestJsonScalars", TestJsonScalars) |
| 128 |
t.Run("TestJsonOmitempty", TestJsonOmitempty) |
| 129 |
t.Run("TestJsonIntfMapping", TestJsonIntfMapping) |
| 130 |
t.Run("TestJsonMissingFields", TestJsonMissingFields) |
| 131 |
t.Run("TestJsonMaxDepth", TestJsonMaxDepth) |
| 132 |
t.Run("TestJsonSelfExt", TestJsonSelfExt) |
| 133 |
t.Run("TestJsonBytesEncodedAsArray", TestJsonBytesEncodedAsArray) |
| 134 |
t.Run("TestJsonMapEncodeForCanonical", TestJsonMapEncodeForCanonical) |
| 135 |
t.Run("TestJsonRawToStringToRawEtc", TestJsonRawToStringToRawEtc) |
| 136 |
t.Run("TestJsonStructKeyType", TestJsonStructKeyType) |
| 137 |
t.Run("TestJsonPreferArrayOverSlice", TestJsonPreferArrayOverSlice) |
| 138 |
t.Run("TestJsonZeroCopyBytes", TestJsonZeroCopyBytes) |
| 139 |
t.Run("TestJsonNumbers", TestJsonNumbers) |
| 140 |
t.Run("TestJsonDesc", TestJsonDesc) |
| 141 |
t.Run("TestJsonStructFieldInfoToArray", TestJsonStructFieldInfoToArray) |
| 142 |
|
| 143 |
t.Run("TestJsonInvalidUnicode", TestJsonInvalidUnicode) |
| 144 |
t.Run("TestJsonNumberParsing", TestJsonNumberParsing) |
| 145 |
} |
| 146 |
|
| 147 |
func testJsonGroupV(t *testing.T) { |
| 148 |
t.Run("TestJsonCodecsTable", TestJsonCodecsTable) |
| 149 |
t.Run("TestJsonCodecsMisc", TestJsonCodecsMisc) |
| 150 |
t.Run("TestJsonSwallowAndZero", TestJsonSwallowAndZero) |
| 151 |
t.Run("TestJsonNextValueBytes", TestJsonNextValueBytes) |
| 152 |
t.Run("TestJsonStrucEncDec", TestJsonStrucEncDec) |
| 153 |
} |
| 154 |
|
| 155 |
func testBincGroup(t *testing.T) { |
| 156 |
t.Run("TestBincCodecsEmbeddedPointer", TestBincCodecsEmbeddedPointer) |
| 157 |
t.Run("TestBincStdEncIntf", TestBincStdEncIntf) |
| 158 |
t.Run("TestBincMammoth", TestBincMammoth) |
| 159 |
t.Run("TestBincRaw", TestBincRaw) |
| 160 |
t.Run("TestBincRpcGo", TestBincRpcGo) |
| 161 |
t.Run("TestBincUnderlyingType", TestBincUnderlyingType) |
| 162 |
|
| 163 |
t.Run("TestBincRawExt", TestBincRawExt) |
| 164 |
t.Run("TestBincMapStructKey", TestBincMapStructKey) |
| 165 |
t.Run("TestBincDecodeNilMapValue", TestBincDecodeNilMapValue) |
| 166 |
t.Run("TestBincEmbeddedFieldPrecedence", TestBincEmbeddedFieldPrecedence) |
| 167 |
t.Run("TestBincLargeContainerLen", TestBincLargeContainerLen) |
| 168 |
t.Run("TestBincMammothMapsAndSlices", TestBincMammothMapsAndSlices) |
| 169 |
t.Run("TestBincTime", TestBincTime) |
| 170 |
t.Run("TestBincUintToInt", TestBincUintToInt) |
| 171 |
t.Run("TestBincDifferentMapOrSliceType", TestBincDifferentMapOrSliceType) |
| 172 |
t.Run("TestBincScalars", TestBincScalars) |
| 173 |
t.Run("TestBincOmitempty", TestBincOmitempty) |
| 174 |
t.Run("TestBincIntfMapping", TestBincIntfMapping) |
| 175 |
t.Run("TestBincMissingFields", TestBincMissingFields) |
| 176 |
t.Run("TestBincMaxDepth", TestBincMaxDepth) |
| 177 |
t.Run("TestBincSelfExt", TestBincSelfExt) |
| 178 |
t.Run("TestBincBytesEncodedAsArray", TestBincBytesEncodedAsArray) |
| 179 |
t.Run("TestBincMapEncodeForCanonical", TestBincMapEncodeForCanonical) |
| 180 |
t.Run("TestBincRawToStringToRawEtc", TestBincRawToStringToRawEtc) |
| 181 |
t.Run("TestBincStructKeyType", TestBincStructKeyType) |
| 182 |
t.Run("TestBincPreferArrayOverSlice", TestBincPreferArrayOverSlice) |
| 183 |
t.Run("TestBincZeroCopyBytes", TestBincZeroCopyBytes) |
| 184 |
t.Run("TestBincNumbers", TestBincNumbers) |
| 185 |
t.Run("TestBincDesc", TestBincDesc) |
| 186 |
t.Run("TestBincStructFieldInfoToArray", TestBincStructFieldInfoToArray) |
| 187 |
} |
| 188 |
|
| 189 |
func testBincGroupV(t *testing.T) { |
| 190 |
t.Run("TestBincCodecsTable", TestBincCodecsTable) |
| 191 |
t.Run("TestBincCodecsMisc", TestBincCodecsMisc) |
| 192 |
t.Run("TestBincSwallowAndZero", TestBincSwallowAndZero) |
| 193 |
t.Run("TestBincNextValueBytes", TestBincNextValueBytes) |
| 194 |
t.Run("TestBincStrucEncDec", TestBincStrucEncDec) |
| 195 |
} |
| 196 |
|
| 197 |
func testCborGroup(t *testing.T) { |
| 198 |
t.Run("TestCborCodecsEmbeddedPointer", TestCborCodecsEmbeddedPointer) |
| 199 |
t.Run("TestCborCodecChan", TestCborCodecChan) |
| 200 |
t.Run("TestCborStdEncIntf", TestCborStdEncIntf) |
| 201 |
t.Run("TestCborMammoth", TestCborMammoth) |
| 202 |
t.Run("TestCborRaw", TestCborRaw) |
| 203 |
t.Run("TestCborRpcGo", TestCborRpcGo) |
| 204 |
|
| 205 |
t.Run("TestCborRawExt", TestCborRawExt) |
| 206 |
t.Run("TestCborMapStructKey", TestCborMapStructKey) |
| 207 |
t.Run("TestCborDecodeNilMapValue", TestCborDecodeNilMapValue) |
| 208 |
t.Run("TestCborEmbeddedFieldPrecedence", TestCborEmbeddedFieldPrecedence) |
| 209 |
t.Run("TestCborLargeContainerLen", TestCborLargeContainerLen) |
| 210 |
t.Run("TestCborMammothMapsAndSlices", TestCborMammothMapsAndSlices) |
| 211 |
t.Run("TestCborTime", TestCborTime) |
| 212 |
t.Run("TestCborUintToInt", TestCborUintToInt) |
| 213 |
t.Run("TestCborDifferentMapOrSliceType", TestCborDifferentMapOrSliceType) |
| 214 |
t.Run("TestCborScalars", TestCborScalars) |
| 215 |
t.Run("TestCborOmitempty", TestCborOmitempty) |
| 216 |
t.Run("TestCborIntfMapping", TestCborIntfMapping) |
| 217 |
t.Run("TestCborMissingFields", TestCborMissingFields) |
| 218 |
t.Run("TestCborMaxDepth", TestCborMaxDepth) |
| 219 |
t.Run("TestCborSelfExt", TestCborSelfExt) |
| 220 |
t.Run("TestCborBytesEncodedAsArray", TestCborBytesEncodedAsArray) |
| 221 |
t.Run("TestCborMapEncodeForCanonical", TestCborMapEncodeForCanonical) |
| 222 |
t.Run("TestCborRawToStringToRawEtc", TestCborRawToStringToRawEtc) |
| 223 |
t.Run("TestCborStructKeyType", TestCborStructKeyType) |
| 224 |
t.Run("TestCborPreferArrayOverSlice", TestCborPreferArrayOverSlice) |
| 225 |
t.Run("TestCborZeroCopyBytes", TestCborZeroCopyBytes) |
| 226 |
t.Run("TestCborNumbers", TestCborNumbers) |
| 227 |
t.Run("TestCborDesc", TestCborDesc) |
| 228 |
t.Run("TestCborStructFieldInfoToArray", TestCborStructFieldInfoToArray) |
| 229 |
|
| 230 |
t.Run("TestCborHalfFloat", TestCborHalfFloat) |
| 231 |
t.Run("TestCborSkipTags", TestCborSkipTags) |
| 232 |
} |
| 233 |
|
| 234 |
func testCborGroupV(t *testing.T) { |
| 235 |
t.Run("TestCborCodecsTable", TestCborCodecsTable) |
| 236 |
t.Run("TestCborCodecsMisc", TestCborCodecsMisc) |
| 237 |
t.Run("TestCborSwallowAndZero", TestCborSwallowAndZero) |
| 238 |
t.Run("TestCborNextValueBytes", TestCborNextValueBytes) |
| 239 |
t.Run("TestCborStrucEncDec", TestCborStrucEncDec) |
| 240 |
} |
| 241 |
|
| 242 |
func testMsgpackGroup(t *testing.T) { |
| 243 |
t.Run("TestMsgpackCodecsEmbeddedPointer", TestMsgpackCodecsEmbeddedPointer) |
| 244 |
t.Run("TestMsgpackStdEncIntf", TestMsgpackStdEncIntf) |
| 245 |
t.Run("TestMsgpackMammoth", TestMsgpackMammoth) |
| 246 |
t.Run("TestMsgpackRaw", TestMsgpackRaw) |
| 247 |
t.Run("TestMsgpackRpcGo", TestMsgpackRpcGo) |
| 248 |
t.Run("TestMsgpackRpcSpec", TestMsgpackRpcSpec) |
| 249 |
|
| 250 |
t.Run("TestMsgpackRawExt", TestMsgpackRawExt) |
| 251 |
t.Run("TestMsgpackMapStructKey", TestMsgpackMapStructKey) |
| 252 |
t.Run("TestMsgpackDecodeNilMapValue", TestMsgpackDecodeNilMapValue) |
| 253 |
t.Run("TestMsgpackEmbeddedFieldPrecedence", TestMsgpackEmbeddedFieldPrecedence) |
| 254 |
t.Run("TestMsgpackLargeContainerLen", TestMsgpackLargeContainerLen) |
| 255 |
t.Run("TestMsgpackMammothMapsAndSlices", TestMsgpackMammothMapsAndSlices) |
| 256 |
t.Run("TestMsgpackTime", TestMsgpackTime) |
| 257 |
t.Run("TestMsgpackUintToInt", TestMsgpackUintToInt) |
| 258 |
t.Run("TestMsgpackDifferentMapOrSliceType", TestMsgpackDifferentMapOrSliceType) |
| 259 |
t.Run("TestMsgpackScalars", TestMsgpackScalars) |
| 260 |
t.Run("TestMsgpackOmitempty", TestMsgpackOmitempty) |
| 261 |
t.Run("TestMsgpackIntfMapping", TestMsgpackIntfMapping) |
| 262 |
t.Run("TestMsgpackMissingFields", TestMsgpackMissingFields) |
| 263 |
t.Run("TestMsgpackMaxDepth", TestMsgpackMaxDepth) |
| 264 |
t.Run("TestMsgpackSelfExt", TestMsgpackSelfExt) |
| 265 |
t.Run("TestMsgpackBytesEncodedAsArray", TestMsgpackBytesEncodedAsArray) |
| 266 |
t.Run("TestMsgpackMapEncodeForCanonical", TestMsgpackMapEncodeForCanonical) |
| 267 |
t.Run("TestMsgpackRawToStringToRawEtc", TestMsgpackRawToStringToRawEtc) |
| 268 |
t.Run("TestMsgpackStructKeyType", TestMsgpackStructKeyType) |
| 269 |
t.Run("TestMsgpackPreferArrayOverSlice", TestMsgpackPreferArrayOverSlice) |
| 270 |
t.Run("TestMsgpackZeroCopyBytes", TestMsgpackZeroCopyBytes) |
| 271 |
t.Run("TestMsgpackNumbers", TestMsgpackNumbers) |
| 272 |
t.Run("TestMsgpackDesc", TestMsgpackDesc) |
| 273 |
t.Run("TestMsgpackStructFieldInfoToArray", TestMsgpackStructFieldInfoToArray) |
| 274 |
|
| 275 |
t.Run("TestMsgpackDecodeMapAndExtSizeMismatch", TestMsgpackDecodeMapAndExtSizeMismatch) |
| 276 |
} |
| 277 |
|
| 278 |
func testMsgpackGroupV(t *testing.T) { |
| 279 |
t.Run("TestMsgpackCodecsTable", TestMsgpackCodecsTable) |
| 280 |
t.Run("TestMsgpackCodecsMisc", TestMsgpackCodecsMisc) |
| 281 |
t.Run("TestMsgpackSwallowAndZero", TestMsgpackSwallowAndZero) |
| 282 |
t.Run("TestMsgpackNextValueBytes", TestMsgpackNextValueBytes) |
| 283 |
t.Run("TestMsgpackStrucEncDec", TestMsgpackStrucEncDec) |
| 284 |
} |
| 285 |
|
| 286 |
func testSimpleGroup(t *testing.T) { |
| 287 |
t.Run("TestSimpleCodecsEmbeddedPointer", TestSimpleCodecsEmbeddedPointer) |
| 288 |
t.Run("TestSimpleStdEncIntf", TestSimpleStdEncIntf) |
| 289 |
t.Run("TestSimpleMammoth", TestSimpleMammoth) |
| 290 |
t.Run("TestSimpleRaw", TestSimpleRaw) |
| 291 |
t.Run("TestSimpleRpcGo", TestSimpleRpcGo) |
| 292 |
|
| 293 |
t.Run("TestSimpleRawExt", TestSimpleRawExt) |
| 294 |
t.Run("TestSimpleMapStructKey", TestSimpleMapStructKey) |
| 295 |
t.Run("TestSimpleDecodeNilMapValue", TestSimpleDecodeNilMapValue) |
| 296 |
t.Run("TestSimpleEmbeddedFieldPrecedence", TestSimpleEmbeddedFieldPrecedence) |
| 297 |
t.Run("TestSimpleLargeContainerLen", TestSimpleLargeContainerLen) |
| 298 |
t.Run("TestSimpleMammothMapsAndSlices", TestSimpleMammothMapsAndSlices) |
| 299 |
t.Run("TestSimpleTime", TestSimpleTime) |
| 300 |
t.Run("TestSimpleUintToInt", TestSimpleUintToInt) |
| 301 |
t.Run("TestSimpleDifferentMapOrSliceType", TestSimpleDifferentMapOrSliceType) |
| 302 |
t.Run("TestSimpleScalars", TestSimpleScalars) |
| 303 |
t.Run("TestSimpleOmitempty", TestSimpleOmitempty) |
| 304 |
t.Run("TestSimpleIntfMapping", TestSimpleIntfMapping) |
| 305 |
t.Run("TestSimpleMissingFields", TestSimpleMissingFields) |
| 306 |
t.Run("TestSimpleMaxDepth", TestSimpleMaxDepth) |
| 307 |
t.Run("TestSimpleSelfExt", TestSimpleSelfExt) |
| 308 |
t.Run("TestSimpleBytesEncodedAsArray", TestSimpleBytesEncodedAsArray) |
| 309 |
t.Run("TestSimpleMapEncodeForCanonical", TestSimpleMapEncodeForCanonical) |
| 310 |
t.Run("TestSimpleRawToStringToRawEtc", TestSimpleRawToStringToRawEtc) |
| 311 |
t.Run("TestSimpleStructKeyType", TestSimpleStructKeyType) |
| 312 |
t.Run("TestSimplePreferArrayOverSlice", TestSimplePreferArrayOverSlice) |
| 313 |
t.Run("TestSimpleZeroCopyBytes", TestSimpleZeroCopyBytes) |
| 314 |
t.Run("TestSimpleNumbers", TestSimpleNumbers) |
| 315 |
t.Run("TestSimpleDesc", TestSimpleDesc) |
| 316 |
t.Run("TestSimpleStructFieldInfoToArray", TestSimpleStructFieldInfoToArray) |
| 317 |
} |
| 318 |
|
| 319 |
func testSimpleGroupV(t *testing.T) { |
| 320 |
t.Run("TestSimpleCodecsTable", TestSimpleCodecsTable) |
| 321 |
t.Run("TestSimpleCodecsMisc", TestSimpleCodecsMisc) |
| 322 |
t.Run("TestSimpleSwallowAndZero", TestSimpleSwallowAndZero) |
| 323 |
t.Run("TestSimpleNextValueBytes", TestSimpleNextValueBytes) |
| 324 |
t.Run("TestSimpleStrucEncDec", TestSimpleStrucEncDec) |
| 325 |
} |
| 326 |
|
| 327 |
func testSimpleMammothGroup(t *testing.T) { |
| 328 |
t.Run("TestSimpleMammothMapsAndSlices", TestSimpleMammothMapsAndSlices) |
| 329 |
} |
| 330 |
|
| 331 |
func testRpcGroup(t *testing.T) { |
| 332 |
t.Run("TestBincRpcGo", TestBincRpcGo) |
| 333 |
t.Run("TestSimpleRpcGo", TestSimpleRpcGo) |
| 334 |
t.Run("TestMsgpackRpcGo", TestMsgpackRpcGo) |
| 335 |
t.Run("TestCborRpcGo", TestCborRpcGo) |
| 336 |
t.Run("TestJsonRpcGo", TestJsonRpcGo) |
| 337 |
t.Run("TestMsgpackRpcSpec", TestMsgpackRpcSpec) |
| 338 |
} |
| 339 |
|
| 340 |
func testNonHandlesGroup(t *testing.T) { |
| 341 |
|
| 342 |
t.Run("TestBufioDecReader", TestBufioDecReader) |
| 343 |
t.Run("TestAtomic", TestAtomic) |
| 344 |
t.Run("TestAllEncCircularRef", TestAllEncCircularRef) |
| 345 |
t.Run("TestAllAnonCycle", TestAllAnonCycle) |
| 346 |
t.Run("TestMultipleEncDec", TestMultipleEncDec) |
| 347 |
t.Run("TestAllErrWriter", TestAllErrWriter) |
| 348 |
t.Run("TestMapRangeIndex", TestMapRangeIndex) |
| 349 |
} |
| 350 |
|
| 351 |
func TestCodecSuite(t *testing.T) { |
| 352 |
var tt testTimeTracker |
| 353 |
tt.Elapsed() |
| 354 |
|
| 355 |
fnRun := func(s string, f func(t *testing.T)) { |
| 356 |
t.Run(s, f) |
| 357 |
|
| 358 |
} |
| 359 |
|
| 360 |
testGroupResetFlags() |
| 361 |
|
| 362 |
testReinit() |
| 363 |
|
| 364 |
fnRun("optionsFalse", testCodecGroup) |
| 365 |
|
| 366 |
testUseIoEncDec = 0 |
| 367 |
testUseReset = true |
| 368 |
testUseParallel = true |
| 369 |
|
| 370 |
testDecodeOptions.ZeroCopy = true |
| 371 |
testDecodeOptions.InternString = true |
| 372 |
testDecodeOptions.MapValueReset = true |
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
testDecodeOptions.SignedInteger = true |
| 378 |
testDecodeOptions.SliceElementReset = true |
| 379 |
testDecodeOptions.InterfaceReset = true |
| 380 |
testDecodeOptions.RawToString = true |
| 381 |
testDecodeOptions.PreferPointerForStructOrArray = true |
| 382 |
|
| 383 |
testEncodeOptions.StructToArray = true |
| 384 |
testEncodeOptions.Canonical = true |
| 385 |
testEncodeOptions.CheckCircularRef = true |
| 386 |
testEncodeOptions.RecursiveEmptyCheck = true |
| 387 |
testEncodeOptions.OptimumSize = true |
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
testJsonH.HTMLCharsAsIs = true |
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
testCborH.IndefiniteLength = true |
| 397 |
testCborH.TimeRFC3339 = true |
| 398 |
testCborH.SkipUnexpectedTags = true |
| 399 |
|
| 400 |
testMsgpackH.WriteExt = true |
| 401 |
testMsgpackH.NoFixedNum = true |
| 402 |
testMsgpackH.PositiveIntUnsigned = true |
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
testReinit() |
| 407 |
fnRun("optionsTrue", testCodecGroup) |
| 408 |
|
| 409 |
testGroupResetFlags() |
| 410 |
|
| 411 |
|
| 412 |
testDepth = 4 |
| 413 |
if testing.Short() { |
| 414 |
testDepth = 2 |
| 415 |
} |
| 416 |
testReinit() |
| 417 |
fnRun("optionsTrue-deepstruct", testCodecGroupV) |
| 418 |
testDepth = 0 |
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
testUseIoWrapper = true |
| 423 |
testReinit() |
| 424 |
fnRun("optionsTrue-ioWrapper", testCodecGroupV) |
| 425 |
testUseIoWrapper = false |
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
testSkipRPCTests = true |
| 435 |
testUseIoEncDec = 16 |
| 436 |
|
| 437 |
|
| 438 |
testReinit() |
| 439 |
fnRun("optionsTrue-bufio", testCodecGroupV) |
| 440 |
|
| 441 |
|
| 442 |
testSkipRPCTests = false |
| 443 |
testUseIoEncDec = -1 |
| 444 |
|
| 445 |
|
| 446 |
testNumRepeatString = 32 |
| 447 |
testReinit() |
| 448 |
fnRun("optionsTrue-largestrings", testCodecGroupV) |
| 449 |
testNumRepeatString = 8 |
| 450 |
|
| 451 |
testGroupResetFlags() |
| 452 |
|
| 453 |
|
| 454 |
fnJsonReset := func(ml int, d int8, hca, mkas bool) func() { |
| 455 |
return func() { |
| 456 |
testMaxInitLen = ml |
| 457 |
testJsonH.Indent = d |
| 458 |
testJsonH.HTMLCharsAsIs = hca |
| 459 |
testJsonH.MapKeyAsString = mkas |
| 460 |
} |
| 461 |
}(testMaxInitLen, testJsonH.Indent, testJsonH.HTMLCharsAsIs, testJsonH.MapKeyAsString) |
| 462 |
|
| 463 |
testMaxInitLen = 10 |
| 464 |
testJsonH.MapKeyAsString = true |
| 465 |
|
| 466 |
testJsonH.Indent = 8 |
| 467 |
testJsonH.HTMLCharsAsIs = true |
| 468 |
testReinit() |
| 469 |
fnRun("json-spaces-htmlcharsasis-initLen10", testJsonGroup) |
| 470 |
|
| 471 |
testJsonH.Indent = -1 |
| 472 |
testJsonH.HTMLCharsAsIs = false |
| 473 |
testReinit() |
| 474 |
fnRun("json-tabs-initLen10", testJsonGroup) |
| 475 |
|
| 476 |
fnJsonReset() |
| 477 |
|
| 478 |
|
| 479 |
oldSymbols := testBincH.AsSymbols |
| 480 |
|
| 481 |
testBincH.AsSymbols = 2 |
| 482 |
testReinit() |
| 483 |
fnRun("binc-no-symbols", testBincGroup) |
| 484 |
|
| 485 |
testBincH.AsSymbols = 1 |
| 486 |
testReinit() |
| 487 |
fnRun("binc-all-symbols", testBincGroup) |
| 488 |
|
| 489 |
testBincH.AsSymbols = oldSymbols |
| 490 |
|
| 491 |
|
| 492 |
oldEncZeroValuesAsNil := testSimpleH.EncZeroValuesAsNil |
| 493 |
testSimpleH.EncZeroValuesAsNil = !testSimpleH.EncZeroValuesAsNil |
| 494 |
testReinit() |
| 495 |
fnRun("simple-enczeroasnil", testSimpleMammothGroup) |
| 496 |
testSimpleH.EncZeroValuesAsNil = oldEncZeroValuesAsNil |
| 497 |
|
| 498 |
|
| 499 |
testUseIoEncDec = 16 |
| 500 |
testRPCOptions.RPCNoBuffer = false |
| 501 |
testReinit() |
| 502 |
testRpcBufsize = 0 |
| 503 |
fnRun("rpc-buf-0", testRpcGroup) |
| 504 |
testRpcBufsize = 0 |
| 505 |
fnRun("rpc-buf-00", testRpcGroup) |
| 506 |
testRpcBufsize = 0 |
| 507 |
fnRun("rpc-buf-000", testRpcGroup) |
| 508 |
testRpcBufsize = 16 |
| 509 |
fnRun("rpc-buf-16", testRpcGroup) |
| 510 |
testRpcBufsize = 2048 |
| 511 |
fnRun("rpc-buf-2048", testRpcGroup) |
| 512 |
|
| 513 |
testRPCOptions.RPCNoBuffer = true |
| 514 |
testRpcBufsize = 0 |
| 515 |
fnRun("rpc-buf-0-rpcNoBuffer", testRpcGroup) |
| 516 |
testRpcBufsize = 0 |
| 517 |
fnRun("rpc-buf-00-rpcNoBuffer", testRpcGroup) |
| 518 |
testRpcBufsize = 2048 |
| 519 |
fnRun("rpc-buf-2048-rpcNoBuffer", testRpcGroup) |
| 520 |
|
| 521 |
testGroupResetFlags() |
| 522 |
} |
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|