1// Copyright 2017 syzkaller project authors. All rights reserved. 2// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4package serializer 5 6import ( 7 "bytes" 8 "testing" 9) 10 11func TestSerializer(t *testing.T) { 12 x := &X{ 13 Y: Y{1}, 14 P: &Y{2}, 15 A: []Y{{3}, {4}}, 16 F: true, 17 S: "a\x09b", 18 T: T1, 19 } 20 buf := new(bytes.Buffer) 21 Write(buf, x) 22 t.Logf("\n%s", buf.String()) 23 t.Logf("\n%#v", x) 24} 25 26type X struct { 27 Y Y 28 P *Y 29 A []Y 30 F bool 31 S string 32 T T 33} 34 35type Y struct { 36 V int 37} 38 39type T int 40 41const ( 42 _ T = iota 43 T1 44) 45