• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2017, The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package testprotos
6
7func Equal(x, y Message) bool {
8	if x == nil || y == nil {
9		return x == nil && y == nil
10	}
11	return x.String() == y.String()
12}
13
14type Message interface {
15	Proto()
16	String() string
17}
18
19type proto interface {
20	Proto()
21}
22
23type notComparable struct {
24	unexportedField func()
25}
26
27type Stringer struct{ X string }
28
29func (s *Stringer) String() string { return s.X }
30
31// Project1 protocol buffers
32type (
33	Eagle_States         int
34	Eagle_MissingCalls   int
35	Dreamer_States       int
36	Dreamer_MissingCalls int
37	Slap_States          int
38	Goat_States          int
39	Donkey_States        int
40	SummerType           int
41
42	Eagle struct {
43		proto
44		notComparable
45		Stringer
46	}
47	Dreamer struct {
48		proto
49		notComparable
50		Stringer
51	}
52	Slap struct {
53		proto
54		notComparable
55		Stringer
56	}
57	Goat struct {
58		proto
59		notComparable
60		Stringer
61	}
62	Donkey struct {
63		proto
64		notComparable
65		Stringer
66	}
67)
68
69// Project2 protocol buffers
70type (
71	Germ struct {
72		proto
73		notComparable
74		Stringer
75	}
76	Dish struct {
77		proto
78		notComparable
79		Stringer
80	}
81)
82
83// Project3 protocol buffers
84type (
85	Dirt struct {
86		proto
87		notComparable
88		Stringer
89	}
90	Wizard struct {
91		proto
92		notComparable
93		Stringer
94	}
95	Sadistic struct {
96		proto
97		notComparable
98		Stringer
99	}
100)
101
102// Project4 protocol buffers
103type (
104	HoneyStatus int
105	PoisonType  int
106	MetaData    struct {
107		proto
108		notComparable
109		Stringer
110	}
111	Restrictions struct {
112		proto
113		notComparable
114		Stringer
115	}
116)
117