Fixed LookupByKey for Java & C#

Change-Id: I05c02223675dee241d1ae8cb466e5186444058c8
Tested: on Linux.
This commit is contained in:
Wouter van Oortmerssen
2017-05-08 18:24:47 -07:00
parent 0920d663d5
commit 8468ea1ab4
6 changed files with 62 additions and 46 deletions

View File

@@ -50,7 +50,7 @@ namespace FlatBuffers.Test
Monster.StartMonster(fbb);
Monster.AddName(fbb, names[2]);
off[2] = Monster.EndMonster(fbb);
var sortMons = Monster.CreateMySortedVectorOfTables(fbb, off);
var sortMons = Monster.CreateSortedVectorOfMonster(fbb, off);
// We set up the same values as monsterdata.json:
@@ -123,9 +123,9 @@ namespace FlatBuffers.Test
Assert.AreEqual(monster.Testarrayoftables(2).Value.Name, "Wilma");
// Example of searching for a table by the key
Assert.IsTrue(Monster.LookupByKey(sortMons, "Frodo", fbb.DataBuffer) != null);
Assert.IsTrue(Monster.LookupByKey(sortMons, "Barney", fbb.DataBuffer) != null);
Assert.IsTrue(Monster.LookupByKey(sortMons, "Wilma", fbb.DataBuffer)!= null);
Assert.IsTrue(monster.TestarrayoftablesByKey("Frodo") != null);
Assert.IsTrue(monster.TestarrayoftablesByKey("Barney") != null);
Assert.IsTrue(monster.TestarrayoftablesByKey("Wilma") != null);
// testType is an existing field and mutating it should succeed
Assert.AreEqual(monster.TestType, Any.Monster);