mammoth2_generated_test.go 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. // +build !notfastpath
  2. // Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved.
  3. // Use of this source code is governed by a MIT license found in the LICENSE file.
  4. // Code generated from mammoth2-test.go.tmpl - DO NOT EDIT.
  5. package codec
  6. // Increase codecoverage by covering all the codecgen paths, in fast-path and gen-helper.go....
  7. //
  8. // Add:
  9. // - test file for creating a mammoth generated file as _mammoth_generated.go
  10. // - generate a second mammoth files in a different file: mammoth2_generated_test.go
  11. // - mammoth-test.go.tmpl will do this
  12. // - run codecgen on it, into mammoth2_codecgen_generated_test.go (no build tags)
  13. // - as part of TestMammoth, run it also
  14. // - this will cover all the codecgen, gen-helper, etc in one full run
  15. // - check in mammoth* files into github also
  16. // - then
  17. //
  18. // Now, add some types:
  19. // - some that implement BinaryMarshal, TextMarshal, JSONMarshal, and one that implements none of it
  20. // - create a wrapper type that includes TestMammoth2, with it in slices, and maps, and the custom types
  21. // - this wrapper object is what we work encode/decode (so that the codecgen methods are called)
  22. // import "encoding/binary"
  23. import "fmt"
  24. type TestMammoth2 struct {
  25. FIntf interface{}
  26. FptrIntf *interface{}
  27. FString string
  28. FptrString *string
  29. FBytes []byte
  30. FptrBytes *[]byte
  31. FFloat32 float32
  32. FptrFloat32 *float32
  33. FFloat64 float64
  34. FptrFloat64 *float64
  35. FUint uint
  36. FptrUint *uint
  37. FUint8 uint8
  38. FptrUint8 *uint8
  39. FUint16 uint16
  40. FptrUint16 *uint16
  41. FUint32 uint32
  42. FptrUint32 *uint32
  43. FUint64 uint64
  44. FptrUint64 *uint64
  45. FUintptr uintptr
  46. FptrUintptr *uintptr
  47. FInt int
  48. FptrInt *int
  49. FInt8 int8
  50. FptrInt8 *int8
  51. FInt16 int16
  52. FptrInt16 *int16
  53. FInt32 int32
  54. FptrInt32 *int32
  55. FInt64 int64
  56. FptrInt64 *int64
  57. FBool bool
  58. FptrBool *bool
  59. FSliceIntf []interface{}
  60. FptrSliceIntf *[]interface{}
  61. FSliceString []string
  62. FptrSliceString *[]string
  63. FSliceBytes [][]byte
  64. FptrSliceBytes *[][]byte
  65. FSliceFloat32 []float32
  66. FptrSliceFloat32 *[]float32
  67. FSliceFloat64 []float64
  68. FptrSliceFloat64 *[]float64
  69. FSliceUint []uint
  70. FptrSliceUint *[]uint
  71. FSliceUint16 []uint16
  72. FptrSliceUint16 *[]uint16
  73. FSliceUint32 []uint32
  74. FptrSliceUint32 *[]uint32
  75. FSliceUint64 []uint64
  76. FptrSliceUint64 *[]uint64
  77. FSliceInt []int
  78. FptrSliceInt *[]int
  79. FSliceInt8 []int8
  80. FptrSliceInt8 *[]int8
  81. FSliceInt16 []int16
  82. FptrSliceInt16 *[]int16
  83. FSliceInt32 []int32
  84. FptrSliceInt32 *[]int32
  85. FSliceInt64 []int64
  86. FptrSliceInt64 *[]int64
  87. FSliceBool []bool
  88. FptrSliceBool *[]bool
  89. FMapStringIntf map[string]interface{}
  90. FptrMapStringIntf *map[string]interface{}
  91. FMapStringString map[string]string
  92. FptrMapStringString *map[string]string
  93. FMapStringBytes map[string][]byte
  94. FptrMapStringBytes *map[string][]byte
  95. FMapStringUint map[string]uint
  96. FptrMapStringUint *map[string]uint
  97. FMapStringUint8 map[string]uint8
  98. FptrMapStringUint8 *map[string]uint8
  99. FMapStringUint64 map[string]uint64
  100. FptrMapStringUint64 *map[string]uint64
  101. FMapStringInt map[string]int
  102. FptrMapStringInt *map[string]int
  103. FMapStringInt64 map[string]int64
  104. FptrMapStringInt64 *map[string]int64
  105. FMapStringFloat32 map[string]float32
  106. FptrMapStringFloat32 *map[string]float32
  107. FMapStringFloat64 map[string]float64
  108. FptrMapStringFloat64 *map[string]float64
  109. FMapStringBool map[string]bool
  110. FptrMapStringBool *map[string]bool
  111. FMapUintIntf map[uint]interface{}
  112. FptrMapUintIntf *map[uint]interface{}
  113. FMapUintString map[uint]string
  114. FptrMapUintString *map[uint]string
  115. FMapUintBytes map[uint][]byte
  116. FptrMapUintBytes *map[uint][]byte
  117. FMapUintUint map[uint]uint
  118. FptrMapUintUint *map[uint]uint
  119. FMapUintUint8 map[uint]uint8
  120. FptrMapUintUint8 *map[uint]uint8
  121. FMapUintUint64 map[uint]uint64
  122. FptrMapUintUint64 *map[uint]uint64
  123. FMapUintInt map[uint]int
  124. FptrMapUintInt *map[uint]int
  125. FMapUintInt64 map[uint]int64
  126. FptrMapUintInt64 *map[uint]int64
  127. FMapUintFloat32 map[uint]float32
  128. FptrMapUintFloat32 *map[uint]float32
  129. FMapUintFloat64 map[uint]float64
  130. FptrMapUintFloat64 *map[uint]float64
  131. FMapUintBool map[uint]bool
  132. FptrMapUintBool *map[uint]bool
  133. FMapUint8Intf map[uint8]interface{}
  134. FptrMapUint8Intf *map[uint8]interface{}
  135. FMapUint8String map[uint8]string
  136. FptrMapUint8String *map[uint8]string
  137. FMapUint8Bytes map[uint8][]byte
  138. FptrMapUint8Bytes *map[uint8][]byte
  139. FMapUint8Uint map[uint8]uint
  140. FptrMapUint8Uint *map[uint8]uint
  141. FMapUint8Uint8 map[uint8]uint8
  142. FptrMapUint8Uint8 *map[uint8]uint8
  143. FMapUint8Uint64 map[uint8]uint64
  144. FptrMapUint8Uint64 *map[uint8]uint64
  145. FMapUint8Int map[uint8]int
  146. FptrMapUint8Int *map[uint8]int
  147. FMapUint8Int64 map[uint8]int64
  148. FptrMapUint8Int64 *map[uint8]int64
  149. FMapUint8Float32 map[uint8]float32
  150. FptrMapUint8Float32 *map[uint8]float32
  151. FMapUint8Float64 map[uint8]float64
  152. FptrMapUint8Float64 *map[uint8]float64
  153. FMapUint8Bool map[uint8]bool
  154. FptrMapUint8Bool *map[uint8]bool
  155. FMapUint64Intf map[uint64]interface{}
  156. FptrMapUint64Intf *map[uint64]interface{}
  157. FMapUint64String map[uint64]string
  158. FptrMapUint64String *map[uint64]string
  159. FMapUint64Bytes map[uint64][]byte
  160. FptrMapUint64Bytes *map[uint64][]byte
  161. FMapUint64Uint map[uint64]uint
  162. FptrMapUint64Uint *map[uint64]uint
  163. FMapUint64Uint8 map[uint64]uint8
  164. FptrMapUint64Uint8 *map[uint64]uint8
  165. FMapUint64Uint64 map[uint64]uint64
  166. FptrMapUint64Uint64 *map[uint64]uint64
  167. FMapUint64Int map[uint64]int
  168. FptrMapUint64Int *map[uint64]int
  169. FMapUint64Int64 map[uint64]int64
  170. FptrMapUint64Int64 *map[uint64]int64
  171. FMapUint64Float32 map[uint64]float32
  172. FptrMapUint64Float32 *map[uint64]float32
  173. FMapUint64Float64 map[uint64]float64
  174. FptrMapUint64Float64 *map[uint64]float64
  175. FMapUint64Bool map[uint64]bool
  176. FptrMapUint64Bool *map[uint64]bool
  177. FMapIntIntf map[int]interface{}
  178. FptrMapIntIntf *map[int]interface{}
  179. FMapIntString map[int]string
  180. FptrMapIntString *map[int]string
  181. FMapIntBytes map[int][]byte
  182. FptrMapIntBytes *map[int][]byte
  183. FMapIntUint map[int]uint
  184. FptrMapIntUint *map[int]uint
  185. FMapIntUint8 map[int]uint8
  186. FptrMapIntUint8 *map[int]uint8
  187. FMapIntUint64 map[int]uint64
  188. FptrMapIntUint64 *map[int]uint64
  189. FMapIntInt map[int]int
  190. FptrMapIntInt *map[int]int
  191. FMapIntInt64 map[int]int64
  192. FptrMapIntInt64 *map[int]int64
  193. FMapIntFloat32 map[int]float32
  194. FptrMapIntFloat32 *map[int]float32
  195. FMapIntFloat64 map[int]float64
  196. FptrMapIntFloat64 *map[int]float64
  197. FMapIntBool map[int]bool
  198. FptrMapIntBool *map[int]bool
  199. FMapInt64Intf map[int64]interface{}
  200. FptrMapInt64Intf *map[int64]interface{}
  201. FMapInt64String map[int64]string
  202. FptrMapInt64String *map[int64]string
  203. FMapInt64Bytes map[int64][]byte
  204. FptrMapInt64Bytes *map[int64][]byte
  205. FMapInt64Uint map[int64]uint
  206. FptrMapInt64Uint *map[int64]uint
  207. FMapInt64Uint8 map[int64]uint8
  208. FptrMapInt64Uint8 *map[int64]uint8
  209. FMapInt64Uint64 map[int64]uint64
  210. FptrMapInt64Uint64 *map[int64]uint64
  211. FMapInt64Int map[int64]int
  212. FptrMapInt64Int *map[int64]int
  213. FMapInt64Int64 map[int64]int64
  214. FptrMapInt64Int64 *map[int64]int64
  215. FMapInt64Float32 map[int64]float32
  216. FptrMapInt64Float32 *map[int64]float32
  217. FMapInt64Float64 map[int64]float64
  218. FptrMapInt64Float64 *map[int64]float64
  219. FMapInt64Bool map[int64]bool
  220. FptrMapInt64Bool *map[int64]bool
  221. }
  222. // -----------
  223. type testMammoth2Binary uint64
  224. func (x testMammoth2Binary) MarshalBinary() (data []byte, err error) {
  225. data = make([]byte, 8)
  226. bigen.PutUint64(data, uint64(x))
  227. return
  228. }
  229. func (x *testMammoth2Binary) UnmarshalBinary(data []byte) (err error) {
  230. *x = testMammoth2Binary(bigen.Uint64(data))
  231. return
  232. }
  233. type testMammoth2Text uint64
  234. func (x testMammoth2Text) MarshalText() (data []byte, err error) {
  235. data = []byte(fmt.Sprintf("%b", uint64(x)))
  236. return
  237. }
  238. func (x *testMammoth2Text) UnmarshalText(data []byte) (err error) {
  239. _, err = fmt.Sscanf(string(data), "%b", (*uint64)(x))
  240. return
  241. }
  242. type testMammoth2Json uint64
  243. func (x testMammoth2Json) MarshalJSON() (data []byte, err error) {
  244. data = []byte(fmt.Sprintf("%v", uint64(x)))
  245. return
  246. }
  247. func (x *testMammoth2Json) UnmarshalJSON(data []byte) (err error) {
  248. _, err = fmt.Sscanf(string(data), "%v", (*uint64)(x))
  249. return
  250. }
  251. type testMammoth2Basic [4]uint64
  252. type TestMammoth2Wrapper struct {
  253. V TestMammoth2
  254. T testMammoth2Text
  255. B testMammoth2Binary
  256. J testMammoth2Json
  257. C testMammoth2Basic
  258. M map[testMammoth2Basic]TestMammoth2
  259. L []TestMammoth2
  260. A [4]int64
  261. }