summaryrefslogtreecommitdiff
path: root/tests/MyGame/Example/Test.go
diff options
context:
space:
mode:
authorrw <me@rwinslow.com>2014-07-11 16:12:35 -0700
committerWouter van Oortmerssen <wvo@google.com>2014-07-21 16:40:39 -0700
commit74d5f3701fd19ca13b8fe69d1cf54002e11416da (patch)
treebf29f7fb006f6286db1dcd56f03c7c4af5a7d89b /tests/MyGame/Example/Test.go
parent3fb6a86d020f7423553a4e2dbba637b56d7760f6 (diff)
downloadflatbuffers-74d5f3701fd19ca13b8fe69d1cf54002e11416da.tar.gz
flatbuffers-74d5f3701fd19ca13b8fe69d1cf54002e11416da.tar.bz2
flatbuffers-74d5f3701fd19ca13b8fe69d1cf54002e11416da.zip
Port FlatBuffers to Go.
Implement code generation and runtime library for Go, derived from the Java implementation. Additionally, the test suite verifies: - the exact bytes in the Builder buffer during object construction, - vtable deduplication, and - table construction, via a fuzzer derived from the C++ implementation. Change-Id: Ib95a019c684891def2b50281e570b4843fea7baa
Diffstat (limited to 'tests/MyGame/Example/Test.go')
-rw-r--r--tests/MyGame/Example/Test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/MyGame/Example/Test.go b/tests/MyGame/Example/Test.go
new file mode 100644
index 00000000..dc4de8ee
--- /dev/null
+++ b/tests/MyGame/Example/Test.go
@@ -0,0 +1,26 @@
+// automatically generated, do not modify
+
+package Example
+
+import (
+ flatbuffers "github.com/google/flatbuffers/go"
+)
+type Test struct {
+ _tab flatbuffers.Struct
+}
+
+func (rcv *Test) Init(buf []byte, i flatbuffers.UOffsetT) {
+ rcv._tab.Bytes = buf
+ rcv._tab.Pos = i
+}
+
+func (rcv *Test) A() int16 { return rcv._tab.GetInt16(rcv._tab.Pos + flatbuffers.UOffsetT(0)) }
+func (rcv *Test) B() int8 { return rcv._tab.GetInt8(rcv._tab.Pos + flatbuffers.UOffsetT(2)) }
+
+func CreateTest(builder *flatbuffers.Builder, a int16, b int8) flatbuffers.UOffsetT {
+ builder.Prep(2, 4)
+ builder.Pad(1)
+ builder.PrependInt8(b)
+ builder.PrependInt16(a)
+ return builder.Offset()
+}