1// Protocol Buffers for Go with Gadgets
2//
3// Copyright (c) 2015, The GoGo Authors. All rights reserved.
4// http://github.com/gogo/protobuf
5//
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are
8// met:
9//
10//     * Redistributions of source code must retain the above copyright
11// notice, this list of conditions and the following disclaimer.
12//     * Redistributions in binary form must reproduce the above
13// copyright notice, this list of conditions and the following disclaimer
14// in the documentation and/or other materials provided with the
15// distribution.
16//
17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29package test
30
31import (
32	fast "github.com/gogo/protobuf/vanity/test/fast"
33	faster "github.com/gogo/protobuf/vanity/test/faster"
34	slick "github.com/gogo/protobuf/vanity/test/slick"
35	"testing"
36)
37
38func TestFast(t *testing.T) {
39	_ = (&fast.A{}).Marshal
40	_ = (&fast.A{}).MarshalTo
41	_ = (&fast.A{}).Unmarshal
42	_ = (&fast.A{}).Size
43
44	_ = (&fast.B{}).Marshal
45	_ = (&fast.B{}).MarshalTo
46	_ = (&fast.B{}).Unmarshal
47	_ = (&fast.B{}).Size
48}
49
50func TestFaster(t *testing.T) {
51	_ = (&faster.A{}).Marshal
52	_ = (&faster.A{}).MarshalTo
53	_ = (&faster.A{}).Unmarshal
54	_ = (&faster.A{}).Size
55
56	_ = (&faster.A{}).Strings == ""
57
58	_ = (&faster.B{}).Marshal
59	_ = (&faster.B{}).MarshalTo
60	_ = (&faster.B{}).Unmarshal
61	_ = (&faster.B{}).Size
62
63	_ = (&faster.B{}).String_ == nil
64	_ = (&faster.B{}).Int64 == 0
65	_ = (&faster.B{}).Int32 == nil
66	if (&faster.B{}).GetInt32() != 1234 {
67		t.Fatalf("expected default")
68	}
69}
70
71func TestSlick(t *testing.T) {
72	_ = (&slick.A{}).Marshal
73	_ = (&slick.A{}).MarshalTo
74	_ = (&slick.A{}).Unmarshal
75	_ = (&slick.A{}).Size
76
77	_ = (&slick.A{}).Strings == ""
78
79	_ = (&slick.A{}).GoString
80	_ = (&slick.A{}).String
81
82	_ = (&slick.B{}).Marshal
83	_ = (&slick.B{}).MarshalTo
84	_ = (&slick.B{}).Unmarshal
85	_ = (&slick.B{}).Size
86
87	_ = (&slick.B{}).String_ == nil
88	_ = (&slick.B{}).Int64 == 0
89	_ = (&slick.B{}).Int32 == nil
90	if (&slick.B{}).GetInt32() != 1234 {
91		t.Fatalf("expected default")
92	}
93}
94