...
1
16
17 package encoder
18
19 import (
20 "reflect"
21 "testing"
22 "unsafe"
23
24 "github.com/bytedance/sonic/internal/rt"
25 "github.com/stretchr/testify/assert"
26 )
27
28 func TestCompiler_Compile(t *testing.T) {
29 p, err := newCompiler().compile(reflect.TypeOf(_BindingValue), false)
30 assert.Nil(t, err)
31 p.disassemble()
32 }
33
34 func TestReflectDirect(t *testing.T) {
35 type A struct {
36 A int
37 B int
38 }
39 var a A
40 var b = &a
41 println("b:", unsafe.Pointer(b))
42 v := rt.UnpackEface(a)
43 vv := reflect.ValueOf(a)
44 _ = vv
45 println("v:", v.Type.KindFlags, v.Value)
46 pv := rt.UnpackEface(&a)
47 pvv := reflect.ValueOf(&a)
48 _ = pvv
49 println("pv:", pv.Type.KindFlags, pv.Value)
50 }
View as plain text