/external/flatbuffers/tests/FlatBuffers.Test/ |
D | FlatBuffersExampleTests.cs | 141 Monster monster = Monster.GetRootAsMonster(dataBuffer); in CanCreateNewFlatBufferFromScratch() 146 Assert.AreEqual(monster.MutateMana((short)10), false); in CanCreateNewFlatBufferFromScratch() 147 Assert.AreEqual(monster.Mana, (short)150); in CanCreateNewFlatBufferFromScratch() 150 Assert.AreEqual(monster.Testarrayoftables(0).Value.Name, "Barney"); in CanCreateNewFlatBufferFromScratch() 151 Assert.AreEqual(monster.Testarrayoftables(1).Value.Name, "Frodo"); in CanCreateNewFlatBufferFromScratch() 152 Assert.AreEqual(monster.Testarrayoftables(2).Value.Name, "Wilma"); in CanCreateNewFlatBufferFromScratch() 155 Assert.IsTrue(monster.TestarrayoftablesByKey("Frodo") != null); in CanCreateNewFlatBufferFromScratch() 156 Assert.IsTrue(monster.TestarrayoftablesByKey("Barney") != null); in CanCreateNewFlatBufferFromScratch() 157 Assert.IsTrue(monster.TestarrayoftablesByKey("Wilma") != null); in CanCreateNewFlatBufferFromScratch() 160 Assert.AreEqual(monster.TestType, Any.Monster); in CanCreateNewFlatBufferFromScratch() [all …]
|
/external/flatbuffers/samples/ |
D | sample_binary.go | 90 monster := sample.GetRootAsMonster(buf, 0) 94 assert(monster.Mana() == 150, "`monster.Mana()`", strconv.Itoa(int(monster.Mana())), "150") 95 assert(monster.Hp() == 300, "`monster.Hp()`", strconv.Itoa(int(monster.Hp())), "300") 96 assert(string(monster.Name()) == "Orc", "`string(monster.Name())`", string(monster.Name()), 98 assert(monster.Color() == sample.ColorRed, "`monster.Color()`", 99 strconv.Itoa(int(monster.Color())), strconv.Itoa(int(sample.ColorRed))) 105 assert(monster.Pos(nil).X() == 1.0, "`monster.Pos(nil).X()`", 106 strconv.FormatFloat(float64(monster.Pos(nil).X()), 'f', 1, 32), "1.0") 107 assert(monster.Pos(nil).Y() == 2.0, "`monster.Pos(nil).Y()`", 108 strconv.FormatFloat(float64(monster.Pos(nil).Y()), 'f', 1, 32), "2.0") [all …]
|
D | SampleBinary.cs | 70 var monster = Monster.GetRootAsMonster(buf); in Main() 76 Assert(monster.Mana == 150, "monster.Mana", Convert.ToString(monster.Mana), in Main() 78 Assert(monster.Hp == 300, "monster.Hp", Convert.ToString(monster.Hp), Convert.ToString(30)); in Main() 79 Assert(monster.Name.Equals("Orc", StringComparison.Ordinal), "monster.Name", monster.Name, in Main() 81 Assert(monster.Color == Color.Red, "monster.Color", Convert.ToString(monster.Color), in Main() 84 var vec = monster.Pos.Value; in Main() 93 for (int i = 0; i < monster.InventoryLength; i++) in Main() 95 Assert(monster.Inventory(i) == i, "monster.Inventory", in Main() 96 Convert.ToString(monster.Inventory(i)), Convert.ToString(i)); in Main() 102 for (int i = 0; i < monster.WeaponsLength; i++) in Main() [all …]
|
D | SampleBinary.java | 74 Monster monster = Monster.getRootAsMonster(buf); in main() local 77 assert monster.mana() == (short)150; in main() 78 assert monster.hp() == (short)300; in main() 79 assert monster.name().equals("Orc"); in main() 80 assert monster.color() == Color.Red; in main() 81 assert monster.pos().x() == 1.0f; in main() 82 assert monster.pos().y() == 2.0f; in main() 83 assert monster.pos().z() == 3.0f; in main() 86 for (int i = 0; i < monster.inventoryLength(); i++) { in main() 87 assert monster.inventory(i) == (byte)i; in main() [all …]
|
D | sample_binary.py | 97 monster = MyGame.Sample.Monster.Monster.GetRootAsMonster(buf, 0) 100 assert monster.Mana() == 150 101 assert monster.Hp() == 300 102 assert monster.Name() == 'Orc' 103 assert monster.Color() == MyGame.Sample.Color.Color().Red 104 assert monster.Pos().X() == 1.0 105 assert monster.Pos().Y() == 2.0 106 assert monster.Pos().Z() == 3.0 109 for i in xrange(monster.InventoryLength()): 110 assert monster.Inventory(i) == i [all …]
|
D | samplebinary.js | 74 var monster = MyGame.Sample.Monster.getRootAsMonster(buf); 77 assert.equal(monster.mana(), 150); 78 assert.equal(monster.hp(), 300); 79 assert.equal(monster.name(), 'Orc'); 80 assert.equal(monster.color(), MyGame.Sample.Color.Red); 81 assert.equal(monster.pos().x(), 1.0); 82 assert.equal(monster.pos().y(), 2.0); 83 assert.equal(monster.pos().z(), 3.0); 86 for (var i = 0; i < monster.inventoryLength(); i++) { 87 assert.equal(monster.inventory(i), i); [all …]
|
D | SampleBinary.php | 78 $monster = \MyGame\Sample\Monster::GetRootAsMonster($buf); 83 $success &= assert($monster->getMana() == 150); 84 $success &= assert($monster->getHp() == 300); 85 $success &= assert($monster->getName() == "Orc"); 86 $success &= assert($monster->getColor() == \MyGame\Sample\Color::Red); 87 $success &= assert($monster->getPos()->getX() == 1.0); 88 $success &= assert($monster->getPos()->getY() == 2.0); 89 $success &= assert($monster->getPos()->getZ() == 3.0); 92 for ($i = 0; $i < $monster->getInventoryLength(); $i++) { 93 $success &= assert($monster->getInventory($i) == $i); [all …]
|
D | sample_binary.lua | 12 local monster = require("MyGame.Sample.Monster") 41 monster.StartInventoryVector(builder, 10) 49 monster.StartWeaponsVector(builder, 2) 55 monster.Start(builder) 56 monster.AddPos(builder, vec3.CreateVec3(builder, 1.0, 2.0, 3.0)) 57 monster.AddHp(builder, 300) 58 monster.AddName(builder, name) 59 monster.AddInventory(builder, inv) 60 monster.AddColor(builder, color.Red) 61 monster.AddWeapons(builder, weapons) [all …]
|
D | sample_binary.rs | 101 let monster = get_root_as_monster(buf); in main() localVariable 104 let hp = monster.hp(); in main() 105 let mana = monster.mana(); in main() 106 let name = monster.name(); in main() 113 assert!(monster.pos().is_some()); in main() 114 let pos = monster.pos().unwrap(); in main() 123 assert!(monster.inventory().is_some()); in main() 124 let inv = monster.inventory().unwrap(); in main() 132 assert!(monster.weapons().is_some()); in main() 133 let weps = monster.weapons().unwrap(); in main() [all …]
|
D | sample_binary.lobster | 23 // Create some weapons for our monster. 36 // Name of the monster. 42 // Now pack it all together in our root monster object. 67 let monster = MyGame_Sample_GetRootAsMonster(buf) 70 assert monster.mana == 150 71 assert monster.hp == 300 72 assert monster.name == "Orc" 73 assert monster.color == MyGame_Sample_Color_Red 74 let pos = monster.pos 81 for(monster.inventory_length) e, i: [all …]
|
D | sample_binary.cpp | 66 auto monster = GetMonster(builder.GetBufferPointer()); in main() local 69 assert(monster->hp() == 80); in main() 70 assert(monster->mana() == 150); // default in main() 71 assert(monster->name()->str() == "MyMonster"); in main() 74 auto pos = monster->pos(); in main() 80 auto inv = monster->inventory(); in main() 88 auto weps = monster->weapons(); in main() 97 assert(monster->equipped_type() == Equipment_Weapon); in main() 98 auto equipped = static_cast<const Weapon *>(monster->equipped()); in main()
|
/external/flatbuffers/tests/ |
D | JavaTest.java | 91 Monster monster = Monster.getRootAsMonster(bb); in TestBuffer() local 93 TestEq(monster.hp(), (short)80); in TestBuffer() 94 TestEq(monster.mana(), (short)150); // default in TestBuffer() 96 TestEq(monster.name(), "MyMonster"); in TestBuffer() 99 Vec3 pos = monster.pos(); in TestBuffer() 109 TestEq(monster.testType(), (byte)Any.Monster); in TestBuffer() 111 TestEq(monster.test(monster2) != null, true); in TestBuffer() 114 TestEq(monster.inventoryLength(), 5); in TestBuffer() 116 for (int i = 0; i < monster.inventoryLength(); i++) in TestBuffer() 117 invsum += monster.inventory(i); in TestBuffer() [all …]
|
D | lobstertest.lobster | 20 let monster = MyGame_Example_GetRootAsMonster(buf) 22 assert monster.hp == 80 23 assert monster.mana == 150 24 assert monster.name == "MyMonster" 26 let vec = monster.pos 39 assert monster.test_type == MyGame_Example_Any_Monster 40 assert monster.test_as_Monster.name == "Fred" 42 assert monster.inventory_length == 5 43 assert sum(map(monster.inventory_length) i: monster.inventory(i)) == 10 46 assert monster.vector_of_longs(i) == pow(10, i * 2) [all …]
|
D | luatest.lua | 18 local mon = monster.GetRootAsMonster(buf, offset) 42 local mon2 = monster.New() 93 monster.StartInventoryVector(b, 5) 101 monster.Start(b) 102 monster.AddName(b, fred) 103 local mon2 = monster.End(b) 105 monster.StartTest4Vector(b, 2) 110 monster.StartTestarrayofstringVector(b, 2) 115 monster.StartVectorOfLongsVector(b, 5) 123 monster.StartVectorOfDoublesVector(b, 3) [all …]
|
D | go_test.go | 150 for _, monster := range []*example.Monster{monster1, monster2} { 151 if got := monster.Hp(); 80 != got { 156 if got := monster.Mana(); 150 != got { 160 if got := monster.Name(); !bytes.Equal([]byte("MyMonster"), got) { 164 if got := monster.Color(); example.ColorBlue != got { 168 if got := monster.Testbool(); true != got { 174 vec = monster.Pos(vec) 180 vec2 := monster.Pos(nil) 228 if got := monster.TestType(); example.AnyMonster != got { 234 if ok := monster.Test(&table2); !ok { [all …]
|
D | JavaScriptTest.js | 98 var monster = MyGame.Example.Monster.getRootAsMonster(bb); 100 monster.mutate_hp(120); 101 assert.strictEqual(monster.hp(), 120); 103 monster.mutate_hp(80); 104 assert.strictEqual(monster.hp(), 80); 106 var manaRes = monster.mutate_mana(10); 115 var monster = MyGame.Example.Monster.getRootAsMonster(bb); 117 assert.strictEqual(monster.hp(), 80); 118 assert.strictEqual(monster.mana(), 150); // default 120 assert.strictEqual(monster.name(), 'MyMonster'); [all …]
|
D | phpTest.php | 100 $monster = \MyGame\Example\Monster::GetRootAsMonster($bb); 102 $assert->strictEqual($monster->GetHp(), 80); 103 $assert->strictEqual($monster->GetMana(), 150); // default 105 $assert->strictEqual($monster->GetName(), 'MyMonster'); 107 $pos = $monster->GetPos(); 118 $assert->strictEqual($monster->GetTestType(), \MyGame\Example\Any::Monster); 121 $assert->strictEqual($monster->GetTest($monster2) != null, true); 124 $assert->strictEqual($monster->GetInventoryLength(), 5); 126 for ($i = 0; $i < $monster->GetInventoryLength(); $i++) { 127 $invsum += $monster->GetInventory($i); [all …]
|
D | test_builder.cpp | 117 const Monster *monster = flatbuffers::GetRoot<Monster>(buf.data()); in verify() local 118 return (monster->name()->str() == expected_name) && (monster->color() == color); in verify() 122 const Monster *monster = flatbuffers::GetRoot<Monster>(buf+offset); in verify() local 123 return (monster->name()->str() == expected_name) && (monster->color() == color); in verify()
|
D | test.cpp | 235 auto monster = GetMonster(flatbuf); in AccessFlatBufferTest() local 237 TEST_EQ(monster->hp(), 80); in AccessFlatBufferTest() 238 TEST_EQ(monster->mana(), 150); // default in AccessFlatBufferTest() 239 TEST_EQ_STR(monster->name()->c_str(), "MyMonster"); in AccessFlatBufferTest() 244 auto pos = monster->pos(); in AccessFlatBufferTest() 250 auto inventory = monster->inventory(); in AccessFlatBufferTest() 280 TEST_EQ(monster->color(), Color_Blue); in AccessFlatBufferTest() 283 TEST_EQ(monster->test_type(), Any_Monster); // First make sure which it is. in AccessFlatBufferTest() 284 auto monster2 = reinterpret_cast<const Monster *>(monster->test()); in AccessFlatBufferTest() 289 auto vecofstrings = monster->testarrayofstring(); in AccessFlatBufferTest() [all …]
|
/external/flatbuffers/docs/source/ |
D | Tutorial.md | 19 through each step necessary to create this monster type using FlatBuffers. 137 [monster.c](https://github.com/dvidelabs/flatcc/blob/master/samples/monster/monster.c) 160 // Example IDL file for our monster's schema. 221 the template to store our `orc` monster. We specify some default values for 278 ./../flatc --cpp monster.fbs 284 ./../flatc --java monster.fbs 290 ./../flatc --csharp monster.fbs 296 ./../flatc --go monster.fbs 302 ./../flatc --python monster.fbs 308 ./../flatc --js monster.fbs [all …]
|
D | GoUsage.md | 58 buf, err := ioutil.ReadFile("monster.dat") 60 monster := example.GetRootAsMonster(buf, 0) 66 hp := monster.Hp() 67 pos := monster.Pos(nil) 74 monster := example.GetRootAsMonster(buf, 0) 77 if ok := monster.MutateHp(10); !ok { 82 monster.Pos().MutateZ(4) 86 if ok := monster.MutateMana(20); !ok {
|
/external/flatbuffers/dart/example/ |
D | example.dart | 47 // Serialize a name for our monster, called "Orc". 65 final monster = new myGame.MonsterBuilder(builder) 77 final int monsteroff = monster.finish(); 117 var monster = new myGame.Monster(buffer); 120 assert(monster.hp == 80); 121 assert(monster.mana == 150); // default 122 assert(monster.name == "MyMonster"); 125 var pos = monster.pos; 130 var inv = monster.inventory; 138 var weps = monster.weapons; [all …]
|
/external/flatbuffers/grpc/tests/ |
D | JavaGrpcTest.java | 69 Monster monster = GameFactory.createMonsterFromStat(request, i); in retrieve() local 70 responseObserver.onNext(monster); in retrieve() 95 public void onNext(Monster monster) { in computeMinMax() 96 if (monster.hp() > maxHp.get()) { in computeMinMax() 98 maxHp.set(monster.hp()); in computeMinMax() 99 maxHpMonsterName.set(monster.name()); in computeMinMax() 102 else if (monster.hp() == maxHp.get()) { in computeMinMax() 107 if (monster.hp() < minHp.get()) { in computeMinMax() 109 minHp.set(monster.hp()); in computeMinMax() 110 minHpMonsterName.set(monster.name()); in computeMinMax() [all …]
|
D | GameFactory.java | 19 Monster monster = Monster.getRootAsMonster(buffer); in createMonster() local 20 return monster; in createMonster() 30 Monster monster = Monster.getRootAsMonster(builder.dataBuffer()); in createMonsterFromStat() local 31 return monster; in createMonsterFromStat()
|
/external/flatbuffers/tests/rust_usage_test/bin/ |
D | monster_example.rs | 14 let monster = my_game::example::get_root_as_monster(&buf[..]); in main() localVariable 15 println!("{}", monster.hp()); // `80` in main() 16 println!("{}", monster.mana()); // default value of `150` in main() 17 println!("{:?}", monster.name()); // Some("MyMonster") in main()
|