From a7206b24cac96c08aecf2f3b4cc3c2e555eec708 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 28 Aug 2017 15:59:22 +0200 Subject: pkg/compiler: check and generate types Move most of the logic from sysgen to pkg/compiler. Update #217 --- pkg/serializer/serializer_test.go | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 pkg/serializer/serializer_test.go (limited to 'pkg/serializer/serializer_test.go') diff --git a/pkg/serializer/serializer_test.go b/pkg/serializer/serializer_test.go new file mode 100644 index 000000000..17cc9550b --- /dev/null +++ b/pkg/serializer/serializer_test.go @@ -0,0 +1,44 @@ +// Copyright 2017 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +package serializer + +import ( + "bytes" + "testing" +) + +func TestSerializer(t *testing.T) { + x := &X{ + Y: Y{1}, + P: &Y{2}, + A: []Y{Y{3}, Y{4}}, + F: true, + S: "a\x09b", + T: T1, + } + buf := new(bytes.Buffer) + Write(buf, x) + t.Logf("\n%s", buf.String()) + t.Logf("\n%#v", x) +} + +type X struct { + Y Y + P *Y + A []Y + F bool + S string + T T +} + +type Y struct { + V int +} + +type T int + +const ( + T0 T = iota + T1 +) -- cgit mrf-deployment