44 "reflect"
55 "testing"
66
7+ "github.com/yomorun/y3-codec-golang/internal/utils"
8+
79 "github.com/yomorun/y3-codec-golang/internal/tester"
810)
911
@@ -24,7 +26,7 @@ func TestBasic_Struct(t *testing.T) {
2426 t .Parallel ()
2527
2628 input := newBasic ()
27- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
29+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
2830
2931 var result tester.BasicTestData
3032 runDecode (t , inputBuf , & result )
@@ -49,7 +51,7 @@ func TestDecode_Embedded(t *testing.T) {
4951 BasicTestData : newBasic (),
5052 Vaction : "drink" ,
5153 }
52- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
54+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
5355
5456 var result tester.EmbeddedTestData
5557 _ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -69,7 +71,7 @@ func TestDecode_EmbeddedMore(t *testing.T) {
6971 t .Parallel ()
7072
7173 input := tester.EmbeddedMoreTestData {EmbeddedTestData : tester.EmbeddedTestData {BasicTestData : newBasic (), Vaction : "drink" }, Vanimal : "bird" }
72- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
74+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
7375
7476 var result tester.EmbeddedMoreTestData
7577 _ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -93,7 +95,7 @@ func TestDecoder_Named(t *testing.T) {
9395 t .Parallel ()
9496
9597 input := tester.NamedTestData {Base : newBasic (), Vaction : "drink" }
96- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
98+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
9799
98100 var result tester.NamedTestData
99101 _ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -113,7 +115,7 @@ func TestDecoder_NamedMore(t *testing.T) {
113115 t .Parallel ()
114116
115117 input := tester.NamedMoreTestData {MyNest : tester.NamedTestData {Base : newBasic (), Vaction : "drink" }, Vanimal : "bird" }
116- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
118+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
117119
118120 var result tester.NamedMoreTestData
119121 _ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -146,7 +148,7 @@ func TestArray(t *testing.T) {
146148 [2 ]float32 {1 , 2 },
147149 [2 ]float64 {1 , 2 },
148150 }
149- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
151+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
150152
151153 var result tester.ArrayTestData
152154 _ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -178,7 +180,7 @@ func TestSlice(t *testing.T) {
178180 []float64 {1 , 2 },
179181 }
180182
181- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
183+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
182184
183185 var result tester.SliceTestData
184186 _ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -210,7 +212,7 @@ func TestSliceStruct(t *testing.T) {
210212 {EmbeddedTestData : tester.EmbeddedTestData {BasicTestData : newBasic (), Vaction : "drink" }, Vanimal : "bird" }},
211213 }
212214
213- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
215+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
214216
215217 var result tester.SliceStructTestData
216218 _ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -258,7 +260,7 @@ func TestArrayStruct(t *testing.T) {
258260 {EmbeddedTestData : tester.EmbeddedTestData {BasicTestData : newBasic (), Vaction : "drink" }, Vanimal : "bird" }},
259261 }
260262
261- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
263+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
262264
263265 var result tester.ArrayStructTestData
264266 _ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -297,7 +299,7 @@ func TestRootSliceWithBasicStruct(t *testing.T) {
297299
298300 input := []tester.BasicTestData {newBasic (), newBasic ()}
299301
300- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
302+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
301303
302304 var result []tester.BasicTestData
303305 _ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -329,7 +331,7 @@ func TestRootSliceWithSliceStruct(t *testing.T) {
329331
330332 input := []tester.SliceStructTestData {input1 , input1 }
331333
332- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
334+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
333335
334336 var result []tester.SliceStructTestData
335337 _ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -375,7 +377,7 @@ func TestNested(t *testing.T) {
375377 BasicList : []tester.BasicTestData {newBasic (), newBasic ()},
376378 }}}}
377379
378- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
380+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
379381
380382 var result tester.NestedTestData
381383 _ , err := newStructDecoder (& result ).Decode (inputBuf )
0 commit comments