added vector mutators

This commit is contained in:
Maor Itzkovitch
2015-08-15 14:48:47 +03:00
parent b062af4c8c
commit 7bfed4b29a
6 changed files with 130 additions and 26 deletions

View File

@@ -107,6 +107,25 @@ namespace FlatBuffers.Test
Assert.AreEqual(monster.MutateTestType(Any.Monster), true);
Assert.AreEqual(monster.TestType, Any.Monster);
//mutate the inventory vector
Assert.AreEqual(monster.MutateInventory(0, 1), true);
Assert.AreEqual(monster.MutateInventory(1, 2), true);
Assert.AreEqual(monster.MutateInventory(2, 3), true);
Assert.AreEqual(monster.MutateInventory(3, 4), true);
Assert.AreEqual(monster.MutateInventory(4, 5), true);
for (int i = 0; i < monster.InventoryLength; i++)
{
Assert.AreEqual(monster.GetInventory(i), i + 1);
}
//reverse mutation
Assert.AreEqual(monster.MutateInventory(0, 0), true);
Assert.AreEqual(monster.MutateInventory(1, 1), true);
Assert.AreEqual(monster.MutateInventory(2, 2), true);
Assert.AreEqual(monster.MutateInventory(3, 3), true);
Assert.AreEqual(monster.MutateInventory(4, 4), true);
// get a struct field and edit one of its fields
Vec3 pos = monster.Pos;
Assert.AreEqual(pos.X, 1.0f);