Created
January 19, 2016 04:09
-
-
Save prideout/c962b47e5b8e3e4790e0 to your computer and use it in GitHub Desktop.
paste-to-console flatbuffers test for Python serialization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cd tests | |
| cat > wombat.fbs <<EOF | |
| namespace Fauna; | |
| struct Foo { x:short; } | |
| table Wombat { foos:[Foo]; } | |
| EOF | |
| ../flatc -p wombat.fbs | |
| cat > wombat.py <<EOF | |
| import flatbuffers, binascii | |
| from Fauna import Wombat, Foo | |
| builder = flatbuffers.Builder(0) | |
| Wombat.WombatStartFoosVector(builder, 2) | |
| Foo.CreateFoo(builder, 0x1111) | |
| Foo.CreateFoo(builder, 0x2222) | |
| foos = builder.EndVector(2) | |
| Wombat.WombatStart(builder) | |
| Wombat.WombatAddFoos(builder, foos) | |
| builder.Finish(Wombat.WombatEnd(builder)) | |
| print binascii.hexlify(builder.Bytes) | |
| EOF | |
| python wombat.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment