4
4
"reflect"
5
5
"testing"
6
6
7
+ "github.com/yomorun/y3-codec-golang/internal/utils"
8
+
7
9
"github.com/yomorun/y3-codec-golang/internal/tester"
8
10
)
9
11
@@ -24,7 +26,7 @@ func TestBasic_Struct(t *testing.T) {
24
26
t .Parallel ()
25
27
26
28
input := newBasic ()
27
- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
29
+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
28
30
29
31
var result tester.BasicTestData
30
32
runDecode (t , inputBuf , & result )
@@ -49,7 +51,7 @@ func TestDecode_Embedded(t *testing.T) {
49
51
BasicTestData : newBasic (),
50
52
Vaction : "drink" ,
51
53
}
52
- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
54
+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
53
55
54
56
var result tester.EmbeddedTestData
55
57
_ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -69,7 +71,7 @@ func TestDecode_EmbeddedMore(t *testing.T) {
69
71
t .Parallel ()
70
72
71
73
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 )
73
75
74
76
var result tester.EmbeddedMoreTestData
75
77
_ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -93,7 +95,7 @@ func TestDecoder_Named(t *testing.T) {
93
95
t .Parallel ()
94
96
95
97
input := tester.NamedTestData {Base : newBasic (), Vaction : "drink" }
96
- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
98
+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
97
99
98
100
var result tester.NamedTestData
99
101
_ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -113,7 +115,7 @@ func TestDecoder_NamedMore(t *testing.T) {
113
115
t .Parallel ()
114
116
115
117
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 )
117
119
118
120
var result tester.NamedMoreTestData
119
121
_ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -146,7 +148,7 @@ func TestArray(t *testing.T) {
146
148
[2 ]float32 {1 , 2 },
147
149
[2 ]float64 {1 , 2 },
148
150
}
149
- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
151
+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
150
152
151
153
var result tester.ArrayTestData
152
154
_ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -178,7 +180,7 @@ func TestSlice(t *testing.T) {
178
180
[]float64 {1 , 2 },
179
181
}
180
182
181
- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
183
+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
182
184
183
185
var result tester.SliceTestData
184
186
_ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -210,7 +212,7 @@ func TestSliceStruct(t *testing.T) {
210
212
{EmbeddedTestData : tester.EmbeddedTestData {BasicTestData : newBasic (), Vaction : "drink" }, Vanimal : "bird" }},
211
213
}
212
214
213
- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
215
+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
214
216
215
217
var result tester.SliceStructTestData
216
218
_ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -258,7 +260,7 @@ func TestArrayStruct(t *testing.T) {
258
260
{EmbeddedTestData : tester.EmbeddedTestData {BasicTestData : newBasic (), Vaction : "drink" }, Vanimal : "bird" }},
259
261
}
260
262
261
- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
263
+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
262
264
263
265
var result tester.ArrayStructTestData
264
266
_ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -297,7 +299,7 @@ func TestRootSliceWithBasicStruct(t *testing.T) {
297
299
298
300
input := []tester.BasicTestData {newBasic (), newBasic ()}
299
301
300
- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
302
+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
301
303
302
304
var result []tester.BasicTestData
303
305
_ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -329,7 +331,7 @@ func TestRootSliceWithSliceStruct(t *testing.T) {
329
331
330
332
input := []tester.SliceStructTestData {input1 , input1 }
331
333
332
- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
334
+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
333
335
334
336
var result []tester.SliceStructTestData
335
337
_ , err := newStructDecoder (& result ).Decode (inputBuf )
@@ -375,7 +377,7 @@ func TestNested(t *testing.T) {
375
377
BasicList : []tester.BasicTestData {newBasic (), newBasic ()},
376
378
}}}}
377
379
378
- inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (rootToken )).Encode (input )
380
+ inputBuf , _ := newStructEncoder (0x3f , structEncoderOptionRoot (utils . RootToken )).Encode (input )
379
381
380
382
var result tester.NestedTestData
381
383
_ , err := newStructDecoder (& result ).Decode (inputBuf )
0 commit comments