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

@@ -127,6 +127,24 @@ class JavaTest {
TestEq(monster.mutateTestType(Any.Monster), true);
TestEq(monster.testType(), (byte)Any.Monster);
//mutate the inventory vector
TestEq(monster.mutateInventory(0, 1), true);
TestEq(monster.mutateInventory(1, 2), true);
TestEq(monster.mutateInventory(2, 3), true);
TestEq(monster.mutateInventory(3, 4), true);
TestEq(monster.mutateInventory(4, 5), true);
for (int i = 0; i < monster.inventoryLength(); i++) {
TestEq(monster.inventory(i), i + 1);
}
//reverse mutation
TestEq(monster.mutateInventory(0, 0), true);
TestEq(monster.mutateInventory(1, 1), true);
TestEq(monster.mutateInventory(2, 2), true);
TestEq(monster.mutateInventory(3, 3), true);
TestEq(monster.mutateInventory(4, 4), true);
// get a struct field and edit one of its fields
Vec3 pos = monster.pos();
TestEq(pos.x(), 1.0f);