z_all_test.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. // +build alltests
  2. // +build go1.7
  3. package codec
  4. // Run this using:
  5. // go test -tags=alltests -run=Suite -coverprofile=cov.out
  6. // go tool cover -html=cov.out
  7. //
  8. // Because build tags are a build time parameter, we will have to test out the
  9. // different tags separately.
  10. // Tags: x codecgen safe appengine notfastpath
  11. //
  12. // These tags should be added to alltests, e.g.
  13. // go test '-tags=alltests x codecgen' -run=Suite -coverprofile=cov.out
  14. //
  15. // To run all tests before submitting code, run:
  16. // a=( "" "safe" "codecgen" "notfastpath" "codecgen notfastpath" "codecgen safe" "safe notfastpath" )
  17. // for i in "${a[@]}"; do echo ">>>> TAGS: $i"; go test "-tags=alltests $i" -run=Suite; done
  18. //
  19. // This only works on go1.7 and above. This is when subtests and suites were supported.
  20. import "testing"
  21. // func TestMain(m *testing.M) {
  22. // println("calling TestMain")
  23. // // set some parameters
  24. // exitcode := m.Run()
  25. // os.Exit(exitcode)
  26. // }
  27. func testGroupResetFlags() {
  28. testUseMust = false
  29. testCanonical = false
  30. testUseMust = false
  31. testInternStr = false
  32. testUseIoEncDec = -1
  33. testStructToArray = false
  34. testCheckCircRef = false
  35. testUseReset = false
  36. testMaxInitLen = 0
  37. testUseIoWrapper = false
  38. testNumRepeatString = 8
  39. }
  40. func testSuite(t *testing.T, f func(t *testing.T)) {
  41. // find . -name "*_test.go" | xargs grep -e 'flag.' | cut -d '&' -f 2 | cut -d ',' -f 1 | grep -e '^test'
  42. // Disregard the following: testVerbose, testInitDebug, testSkipIntf, testJsonIndent (Need a test for it)
  43. testReinit() // so flag.Parse() is called first, and never called again
  44. testDecodeOptions = DecodeOptions{}
  45. testEncodeOptions = EncodeOptions{}
  46. testGroupResetFlags()
  47. testReinit()
  48. t.Run("optionsFalse", f)
  49. testCanonical = true
  50. testUseMust = true
  51. testInternStr = true
  52. testUseIoEncDec = 0
  53. testStructToArray = true
  54. testCheckCircRef = true
  55. testUseReset = true
  56. testDecodeOptions.MapValueReset = true
  57. testReinit()
  58. t.Run("optionsTrue", f)
  59. testEncodeOptions.AsSymbols = AsSymbolAll
  60. testUseIoWrapper = true
  61. testReinit()
  62. t.Run("optionsTrue-ioWrapper", f)
  63. testUseIoEncDec = -1
  64. testDepth = 6
  65. testReinit()
  66. t.Run("optionsTrue-deepstruct", f)
  67. // make buffer small enough so that we have to re-fill multiple times.
  68. testSkipRPCTests = true
  69. testUseIoEncDec = 128
  70. // testDecodeOptions.ReaderBufferSize = 128
  71. // testEncodeOptions.WriterBufferSize = 128
  72. testReinit()
  73. t.Run("optionsTrue-bufio", f)
  74. // testDecodeOptions.ReaderBufferSize = 0
  75. // testEncodeOptions.WriterBufferSize = 0
  76. testUseIoEncDec = -1
  77. testSkipRPCTests = false
  78. testNumRepeatString = 32
  79. testReinit()
  80. t.Run("optionsTrue-largestrings", f)
  81. // The following here MUST be tested individually, as they create
  82. // side effects i.e. the decoded value is different.
  83. // testDecodeOptions.MapValueReset = true // ok - no side effects
  84. // testDecodeOptions.InterfaceReset = true // error??? because we do deepEquals to verify
  85. // testDecodeOptions.ErrorIfNoField = true // error, as expected, as fields not there
  86. // testDecodeOptions.ErrorIfNoArrayExpand = true // no error, but no error case either
  87. // testDecodeOptions.PreferArrayOverSlice = true // error??? because slice != array.
  88. // .... however, update deepEqual to take this option
  89. // testReinit()
  90. // t.Run("optionsTrue-resetOptions", f)
  91. testGroupResetFlags()
  92. }
  93. /*
  94. find . -name "codec_test.go" | xargs grep -e '^func Test' | \
  95. cut -d '(' -f 1 | cut -d ' ' -f 2 | \
  96. while read f; do echo "t.Run(\"$f\", $f)"; done
  97. */
  98. func testCodecGroup(t *testing.T) {
  99. // println("running testcodecsuite")
  100. // <setup code>
  101. t.Run("TestBincCodecsTable", TestBincCodecsTable)
  102. t.Run("TestBincCodecsMisc", TestBincCodecsMisc)
  103. t.Run("TestBincCodecsEmbeddedPointer", TestBincCodecsEmbeddedPointer)
  104. t.Run("TestBincStdEncIntf", TestBincStdEncIntf)
  105. t.Run("TestBincMammoth", TestBincMammoth)
  106. t.Run("TestSimpleCodecsTable", TestSimpleCodecsTable)
  107. t.Run("TestSimpleCodecsMisc", TestSimpleCodecsMisc)
  108. t.Run("TestSimpleCodecsEmbeddedPointer", TestSimpleCodecsEmbeddedPointer)
  109. t.Run("TestSimpleStdEncIntf", TestSimpleStdEncIntf)
  110. t.Run("TestSimpleMammoth", TestSimpleMammoth)
  111. t.Run("TestMsgpackCodecsTable", TestMsgpackCodecsTable)
  112. t.Run("TestMsgpackCodecsMisc", TestMsgpackCodecsMisc)
  113. t.Run("TestMsgpackCodecsEmbeddedPointer", TestMsgpackCodecsEmbeddedPointer)
  114. t.Run("TestMsgpackStdEncIntf", TestMsgpackStdEncIntf)
  115. t.Run("TestMsgpackMammoth", TestMsgpackMammoth)
  116. t.Run("TestCborCodecsTable", TestCborCodecsTable)
  117. t.Run("TestCborCodecsMisc", TestCborCodecsMisc)
  118. t.Run("TestCborCodecsEmbeddedPointer", TestCborCodecsEmbeddedPointer)
  119. t.Run("TestCborMapEncodeForCanonical", TestCborMapEncodeForCanonical)
  120. t.Run("TestCborCodecChan", TestCborCodecChan)
  121. t.Run("TestCborStdEncIntf", TestCborStdEncIntf)
  122. t.Run("TestCborMammoth", TestCborMammoth)
  123. t.Run("TestJsonCodecsTable", TestJsonCodecsTable)
  124. t.Run("TestJsonCodecsMisc", TestJsonCodecsMisc)
  125. t.Run("TestJsonCodecsEmbeddedPointer", TestJsonCodecsEmbeddedPointer)
  126. t.Run("TestJsonCodecChan", TestJsonCodecChan)
  127. t.Run("TestJsonStdEncIntf", TestJsonStdEncIntf)
  128. t.Run("TestJsonMammoth", TestJsonMammoth)
  129. t.Run("TestJsonRaw", TestJsonRaw)
  130. t.Run("TestBincRaw", TestBincRaw)
  131. t.Run("TestMsgpackRaw", TestMsgpackRaw)
  132. t.Run("TestSimpleRaw", TestSimpleRaw)
  133. t.Run("TestCborRaw", TestCborRaw)
  134. t.Run("TestAllEncCircularRef", TestAllEncCircularRef)
  135. t.Run("TestAllAnonCycle", TestAllAnonCycle)
  136. t.Run("TestBincRpcGo", TestBincRpcGo)
  137. t.Run("TestSimpleRpcGo", TestSimpleRpcGo)
  138. t.Run("TestMsgpackRpcGo", TestMsgpackRpcGo)
  139. t.Run("TestCborRpcGo", TestCborRpcGo)
  140. t.Run("TestJsonRpcGo", TestJsonRpcGo)
  141. t.Run("TestMsgpackRpcSpec", TestMsgpackRpcSpec)
  142. t.Run("TestBincUnderlyingType", TestBincUnderlyingType)
  143. t.Run("TestJsonLargeInteger", TestJsonLargeInteger)
  144. t.Run("TestJsonDecodeNonStringScalarInStringContext", TestJsonDecodeNonStringScalarInStringContext)
  145. t.Run("TestJsonEncodeIndent", TestJsonEncodeIndent)
  146. t.Run("TestJsonSwallowAndZero", TestJsonSwallowAndZero)
  147. t.Run("TestCborSwallowAndZero", TestCborSwallowAndZero)
  148. t.Run("TestMsgpackSwallowAndZero", TestMsgpackSwallowAndZero)
  149. t.Run("TestBincSwallowAndZero", TestBincSwallowAndZero)
  150. t.Run("TestSimpleSwallowAndZero", TestSimpleSwallowAndZero)
  151. t.Run("TestJsonRawExt", TestJsonRawExt)
  152. t.Run("TestCborRawExt", TestCborRawExt)
  153. t.Run("TestMsgpackRawExt", TestMsgpackRawExt)
  154. t.Run("TestBincRawExt", TestBincRawExt)
  155. t.Run("TestSimpleRawExt", TestSimpleRawExt)
  156. t.Run("TestJsonMapStructKey", TestJsonMapStructKey)
  157. t.Run("TestCborMapStructKey", TestCborMapStructKey)
  158. t.Run("TestMsgpackMapStructKey", TestMsgpackMapStructKey)
  159. t.Run("TestBincMapStructKey", TestBincMapStructKey)
  160. t.Run("TestSimpleMapStructKey", TestSimpleMapStructKey)
  161. t.Run("TestJsonDecodeNilMapValue", TestJsonDecodeNilMapValue)
  162. t.Run("TestCborDecodeNilMapValue", TestCborDecodeNilMapValue)
  163. t.Run("TestMsgpackDecodeNilMapValue", TestMsgpackDecodeNilMapValue)
  164. t.Run("TestBincDecodeNilMapValue", TestBincDecodeNilMapValue)
  165. t.Run("TestSimpleDecodeNilMapValue", TestSimpleDecodeNilMapValue)
  166. t.Run("TestJsonEmbeddedFieldPrecedence", TestJsonEmbeddedFieldPrecedence)
  167. t.Run("TestCborEmbeddedFieldPrecedence", TestCborEmbeddedFieldPrecedence)
  168. t.Run("TestMsgpackEmbeddedFieldPrecedence", TestMsgpackEmbeddedFieldPrecedence)
  169. t.Run("TestBincEmbeddedFieldPrecedence", TestBincEmbeddedFieldPrecedence)
  170. t.Run("TestSimpleEmbeddedFieldPrecedence", TestSimpleEmbeddedFieldPrecedence)
  171. t.Run("TestJsonLargeContainerLen", TestJsonLargeContainerLen)
  172. t.Run("TestCborLargeContainerLen", TestCborLargeContainerLen)
  173. t.Run("TestMsgpackLargeContainerLen", TestMsgpackLargeContainerLen)
  174. t.Run("TestBincLargeContainerLen", TestBincLargeContainerLen)
  175. t.Run("TestSimpleLargeContainerLen", TestSimpleLargeContainerLen)
  176. t.Run("TestJsonMammothMapsAndSlices", TestJsonMammothMapsAndSlices)
  177. t.Run("TestCborMammothMapsAndSlices", TestCborMammothMapsAndSlices)
  178. t.Run("TestMsgpackMammothMapsAndSlices", TestMsgpackMammothMapsAndSlices)
  179. t.Run("TestBincMammothMapsAndSlices", TestBincMammothMapsAndSlices)
  180. t.Run("TestSimpleMammothMapsAndSlices", TestSimpleMammothMapsAndSlices)
  181. t.Run("TestJsonTime", TestJsonTime)
  182. t.Run("TestCborTime", TestCborTime)
  183. t.Run("TestMsgpackTime", TestMsgpackTime)
  184. t.Run("TestBincTime", TestBincTime)
  185. t.Run("TestSimpleTime", TestSimpleTime)
  186. t.Run("TestJsonUintToInt", TestJsonUintToInt)
  187. t.Run("TestCborUintToInt", TestCborUintToInt)
  188. t.Run("TestMsgpackUintToInt", TestMsgpackUintToInt)
  189. t.Run("TestBincUintToInt", TestBincUintToInt)
  190. t.Run("TestSimpleUintToInt", TestSimpleUintToInt)
  191. t.Run("TestJsonDifferentMapOrSliceType", TestJsonDifferentMapOrSliceType)
  192. t.Run("TestCborDifferentMapOrSliceType", TestCborDifferentMapOrSliceType)
  193. t.Run("TestMsgpackDifferentMapOrSliceType", TestMsgpackDifferentMapOrSliceType)
  194. t.Run("TestBincDifferentMapOrSliceType", TestBincDifferentMapOrSliceType)
  195. t.Run("TestSimpleDifferentMapOrSliceType", TestSimpleDifferentMapOrSliceType)
  196. t.Run("TestJsonScalars", TestJsonScalars)
  197. t.Run("TestCborScalars", TestCborScalars)
  198. t.Run("TestMsgpackScalars", TestMsgpackScalars)
  199. t.Run("TestBincScalars", TestBincScalars)
  200. t.Run("TestSimpleScalars", TestSimpleScalars)
  201. t.Run("TestJsonInvalidUnicode", TestJsonInvalidUnicode)
  202. t.Run("TestCborHalfFloat", TestCborHalfFloat)
  203. // <tear-down code>
  204. }
  205. func testJsonGroup(t *testing.T) {
  206. t.Run("TestJsonCodecsTable", TestJsonCodecsTable)
  207. t.Run("TestJsonCodecsMisc", TestJsonCodecsMisc)
  208. t.Run("TestJsonCodecsEmbeddedPointer", TestJsonCodecsEmbeddedPointer)
  209. t.Run("TestJsonCodecChan", TestJsonCodecChan)
  210. t.Run("TestJsonStdEncIntf", TestJsonStdEncIntf)
  211. t.Run("TestJsonMammoth", TestJsonMammoth)
  212. t.Run("TestJsonRaw", TestJsonRaw)
  213. t.Run("TestJsonRpcGo", TestJsonRpcGo)
  214. t.Run("TestJsonLargeInteger", TestJsonLargeInteger)
  215. t.Run("TestJsonDecodeNonStringScalarInStringContext", TestJsonDecodeNonStringScalarInStringContext)
  216. t.Run("TestJsonEncodeIndent", TestJsonEncodeIndent)
  217. t.Run("TestJsonSwallowAndZero", TestJsonSwallowAndZero)
  218. t.Run("TestJsonRawExt", TestJsonRawExt)
  219. t.Run("TestJsonMapStructKey", TestJsonMapStructKey)
  220. t.Run("TestJsonDecodeNilMapValue", TestJsonDecodeNilMapValue)
  221. t.Run("TestJsonEmbeddedFieldPrecedence", TestJsonEmbeddedFieldPrecedence)
  222. t.Run("TestJsonLargeContainerLen", TestJsonLargeContainerLen)
  223. t.Run("TestJsonMammothMapsAndSlices", TestJsonMammothMapsAndSlices)
  224. t.Run("TestJsonInvalidUnicode", TestJsonInvalidUnicode)
  225. t.Run("TestJsonTime", TestJsonTime)
  226. t.Run("TestJsonUintToInt", TestJsonUintToInt)
  227. t.Run("TestJsonDifferentMapOrSliceType", TestJsonDifferentMapOrSliceType)
  228. t.Run("TestJsonScalars", TestJsonScalars)
  229. }
  230. func testBincGroup(t *testing.T) {
  231. t.Run("TestBincCodecsTable", TestBincCodecsTable)
  232. t.Run("TestBincCodecsMisc", TestBincCodecsMisc)
  233. t.Run("TestBincCodecsEmbeddedPointer", TestBincCodecsEmbeddedPointer)
  234. t.Run("TestBincStdEncIntf", TestBincStdEncIntf)
  235. t.Run("TestBincMammoth", TestBincMammoth)
  236. t.Run("TestBincRaw", TestBincRaw)
  237. t.Run("TestSimpleRpcGo", TestSimpleRpcGo)
  238. t.Run("TestBincUnderlyingType", TestBincUnderlyingType)
  239. t.Run("TestBincSwallowAndZero", TestBincSwallowAndZero)
  240. t.Run("TestBincRawExt", TestBincRawExt)
  241. t.Run("TestBincMapStructKey", TestBincMapStructKey)
  242. t.Run("TestBincDecodeNilMapValue", TestBincDecodeNilMapValue)
  243. t.Run("TestBincEmbeddedFieldPrecedence", TestBincEmbeddedFieldPrecedence)
  244. t.Run("TestBincLargeContainerLen", TestBincLargeContainerLen)
  245. t.Run("TestBincMammothMapsAndSlices", TestBincMammothMapsAndSlices)
  246. t.Run("TestBincTime", TestBincTime)
  247. t.Run("TestBincUintToInt", TestBincUintToInt)
  248. t.Run("TestBincDifferentMapOrSliceType", TestBincDifferentMapOrSliceType)
  249. t.Run("TestBincScalars", TestBincScalars)
  250. }
  251. func testCborGroup(t *testing.T) {
  252. t.Run("TestCborCodecsTable", TestCborCodecsTable)
  253. t.Run("TestCborCodecsMisc", TestCborCodecsMisc)
  254. t.Run("TestCborCodecsEmbeddedPointer", TestCborCodecsEmbeddedPointer)
  255. t.Run("TestCborMapEncodeForCanonical", TestCborMapEncodeForCanonical)
  256. t.Run("TestCborCodecChan", TestCborCodecChan)
  257. t.Run("TestCborStdEncIntf", TestCborStdEncIntf)
  258. t.Run("TestCborMammoth", TestCborMammoth)
  259. t.Run("TestCborRaw", TestCborRaw)
  260. t.Run("TestCborRpcGo", TestCborRpcGo)
  261. t.Run("TestCborSwallowAndZero", TestCborSwallowAndZero)
  262. t.Run("TestCborRawExt", TestCborRawExt)
  263. t.Run("TestCborMapStructKey", TestCborMapStructKey)
  264. t.Run("TestCborDecodeNilMapValue", TestCborDecodeNilMapValue)
  265. t.Run("TestCborEmbeddedFieldPrecedence", TestCborEmbeddedFieldPrecedence)
  266. t.Run("TestCborLargeContainerLen", TestCborLargeContainerLen)
  267. t.Run("TestCborMammothMapsAndSlices", TestCborMammothMapsAndSlices)
  268. t.Run("TestCborTime", TestCborTime)
  269. t.Run("TestCborUintToInt", TestCborUintToInt)
  270. t.Run("TestCborDifferentMapOrSliceType", TestCborDifferentMapOrSliceType)
  271. t.Run("TestCborScalars", TestCborScalars)
  272. t.Run("TestCborHalfFloat", TestCborHalfFloat)
  273. }
  274. func testMsgpackGroup(t *testing.T) {
  275. t.Run("TestMsgpackCodecsTable", TestMsgpackCodecsTable)
  276. t.Run("TestMsgpackCodecsMisc", TestMsgpackCodecsMisc)
  277. t.Run("TestMsgpackCodecsEmbeddedPointer", TestMsgpackCodecsEmbeddedPointer)
  278. t.Run("TestMsgpackStdEncIntf", TestMsgpackStdEncIntf)
  279. t.Run("TestMsgpackMammoth", TestMsgpackMammoth)
  280. t.Run("TestMsgpackRaw", TestMsgpackRaw)
  281. t.Run("TestMsgpackRpcGo", TestMsgpackRpcGo)
  282. t.Run("TestMsgpackRpcSpec", TestMsgpackRpcSpec)
  283. t.Run("TestMsgpackSwallowAndZero", TestMsgpackSwallowAndZero)
  284. t.Run("TestMsgpackRawExt", TestMsgpackRawExt)
  285. t.Run("TestMsgpackMapStructKey", TestMsgpackMapStructKey)
  286. t.Run("TestMsgpackDecodeNilMapValue", TestMsgpackDecodeNilMapValue)
  287. t.Run("TestMsgpackEmbeddedFieldPrecedence", TestMsgpackEmbeddedFieldPrecedence)
  288. t.Run("TestMsgpackLargeContainerLen", TestMsgpackLargeContainerLen)
  289. t.Run("TestMsgpackMammothMapsAndSlices", TestMsgpackMammothMapsAndSlices)
  290. t.Run("TestMsgpackTime", TestMsgpackTime)
  291. t.Run("TestMsgpackUintToInt", TestMsgpackUintToInt)
  292. t.Run("TestMsgpackDifferentMapOrSliceType", TestMsgpackDifferentMapOrSliceType)
  293. t.Run("TestMsgpackScalars", TestMsgpackScalars)
  294. }
  295. func testRpcGroup(t *testing.T) {
  296. t.Run("TestBincRpcGo", TestBincRpcGo)
  297. t.Run("TestSimpleRpcGo", TestSimpleRpcGo)
  298. t.Run("TestMsgpackRpcGo", TestMsgpackRpcGo)
  299. t.Run("TestCborRpcGo", TestCborRpcGo)
  300. t.Run("TestJsonRpcGo", TestJsonRpcGo)
  301. t.Run("TestMsgpackRpcSpec", TestMsgpackRpcSpec)
  302. }
  303. func TestCodecSuite(t *testing.T) {
  304. testSuite(t, testCodecGroup)
  305. testGroupResetFlags()
  306. oldIndent, oldCharsAsis, oldPreferFloat, oldMapKeyAsString :=
  307. testJsonH.Indent, testJsonH.HTMLCharsAsIs, testJsonH.PreferFloat, testJsonH.MapKeyAsString
  308. testMaxInitLen = 10
  309. testJsonH.Indent = 8
  310. testJsonH.HTMLCharsAsIs = true
  311. testJsonH.MapKeyAsString = true
  312. // testJsonH.PreferFloat = true
  313. testReinit()
  314. t.Run("json-spaces-htmlcharsasis-initLen10", testJsonGroup)
  315. testMaxInitLen = 10
  316. testJsonH.Indent = -1
  317. testJsonH.HTMLCharsAsIs = false
  318. testJsonH.MapKeyAsString = true
  319. // testJsonH.PreferFloat = false
  320. testReinit()
  321. t.Run("json-tabs-initLen10", testJsonGroup)
  322. testJsonH.Indent, testJsonH.HTMLCharsAsIs, testJsonH.PreferFloat, testJsonH.MapKeyAsString =
  323. oldIndent, oldCharsAsis, oldPreferFloat, oldMapKeyAsString
  324. oldIndefLen := testCborH.IndefiniteLength
  325. testCborH.IndefiniteLength = true
  326. testReinit()
  327. t.Run("cbor-indefinitelength", testCborGroup)
  328. testCborH.IndefiniteLength = oldIndefLen
  329. oldSymbols := testBincH.getBasicHandle().AsSymbols
  330. testBincH.getBasicHandle().AsSymbols = AsSymbolNone
  331. testReinit()
  332. t.Run("binc-no-symbols", testBincGroup)
  333. testBincH.getBasicHandle().AsSymbols = AsSymbolAll
  334. testReinit()
  335. t.Run("binc-all-symbols", testBincGroup)
  336. testBincH.getBasicHandle().AsSymbols = oldSymbols
  337. oldWriteExt := testMsgpackH.WriteExt
  338. oldNoFixedNum := testMsgpackH.NoFixedNum
  339. testMsgpackH.WriteExt = !testMsgpackH.WriteExt
  340. testReinit()
  341. t.Run("msgpack-inverse-writeext", testMsgpackGroup)
  342. testMsgpackH.WriteExt = oldWriteExt
  343. testMsgpackH.NoFixedNum = !testMsgpackH.NoFixedNum
  344. testReinit()
  345. t.Run("msgpack-fixednum", testMsgpackGroup)
  346. testMsgpackH.NoFixedNum = oldNoFixedNum
  347. oldRpcBufsize := testRpcBufsize
  348. testRpcBufsize = 0
  349. t.Run("rpc-buf-0", testRpcGroup)
  350. testRpcBufsize = 0
  351. t.Run("rpc-buf-00", testRpcGroup)
  352. testRpcBufsize = 0
  353. t.Run("rpc-buf-000", testRpcGroup)
  354. testRpcBufsize = 16
  355. t.Run("rpc-buf-16", testRpcGroup)
  356. testRpcBufsize = 2048
  357. t.Run("rpc-buf-2048", testRpcGroup)
  358. testRpcBufsize = oldRpcBufsize
  359. testGroupResetFlags()
  360. }
  361. // func TestCodecSuite(t *testing.T) {
  362. // testReinit() // so flag.Parse() is called first, and never called again
  363. // testDecodeOptions, testEncodeOptions = DecodeOptions{}, EncodeOptions{}
  364. // testGroupResetFlags()
  365. // testReinit()
  366. // t.Run("optionsFalse", func(t *testing.T) {
  367. // t.Run("TestJsonMammothMapsAndSlices", TestJsonMammothMapsAndSlices)
  368. // })
  369. // }