public void TestFlipStack() { Debug.Log("Test flip stack start"); StackMeta stack = GetStackMetaOf5(); Debug.Log("Before flip at 0: " + stack.ToStringShort()); stack.FlipStackAt(0); Debug.Log("After flip at 0: " + stack.ToStringShort()); TestManager.AssertEquals(stack.GetChipMetaAt(0).prefabId, 15, ""); TestManager.AssertEquals(stack.GetChipMetaAt(1).prefabId, 14, ""); TestManager.AssertEquals(stack.GetChipMetaAt(2).prefabId, 13, ""); TestManager.AssertEquals(stack.GetChipMetaAt(3).prefabId, 12, ""); TestManager.AssertEquals(stack.GetChipMetaAt(4).prefabId, 11, ""); TestManager.AssertTrue(stack.GetChipMetaAt(0).orientation == ChipOrientation.DOWN, ""); TestManager.AssertTrue(stack.GetChipMetaAt(1).orientation == ChipOrientation.DOWN, ""); TestManager.AssertTrue(stack.GetChipMetaAt(2).orientation == ChipOrientation.DOWN, ""); TestManager.AssertTrue(stack.GetChipMetaAt(3).orientation == ChipOrientation.DOWN, ""); TestManager.AssertTrue(stack.GetChipMetaAt(4).orientation == ChipOrientation.DOWN, ""); TestManager.AssertEquals(stack.GetChipMetaAt(0).stackPos, 0, ""); TestManager.AssertEquals(stack.GetChipMetaAt(1).stackPos, 1, ""); TestManager.AssertEquals(stack.GetChipMetaAt(2).stackPos, 2, ""); TestManager.AssertEquals(stack.GetChipMetaAt(3).stackPos, 3, ""); TestManager.AssertEquals(stack.GetChipMetaAt(4).stackPos, 4, ""); }
public void TestAddChip() { StackMeta stack = new StackMeta(); TestManager.AssertEquals(stack.ChipCount(), 0, "TestAddChip"); stack.Add(new ChipMeta(11, ChipOrientation.UP, false, 12, 0.2f)); TestManager.AssertEquals(stack.ChipCount(), 1, "TestAddChip"); TestManager.AssertEquals(stack.GetChipMetaAt(0).stackPos, 0, "TestAddChip"); stack.Add(new ChipMeta(21, ChipOrientation.UP, false, 122, 0.2f)); TestManager.AssertEquals(stack.GetChipMetaAt(1).stackPos, 1, "TestAddChip"); }
public void TestFlipStackJustTop() { Debug.Log("Test flip stack just top"); StackMeta stack = GetStackMetaOf5(); Debug.Log("Before flip at top: " + stack.ToStringShort()); stack.FlipStackAt(stack.ChipCount() - 1); Debug.Log("After flip at top: " + stack.ToStringShort()); TestManager.AssertTrue(stack.GetChipMetaAt(0).orientation == ChipOrientation.UP, "Wrong orientation for chip"); TestManager.AssertTrue(stack.GetChipMetaAt(1).orientation == ChipOrientation.UP, "Wrong orientation for chip"); TestManager.AssertTrue(stack.GetChipMetaAt(2).orientation == ChipOrientation.UP, "Wrong orientation for chip"); TestManager.AssertTrue(stack.GetChipMetaAt(3).orientation == ChipOrientation.UP, "Wrong orientation for chip"); TestManager.AssertTrue(stack.GetChipMetaAt(4).orientation == ChipOrientation.DOWN, "Wrong orientation for chip"); TestManager.AssertEquals(stack.GetChipMetaAt(4).stackPos, 4, "Wrong stackpos for chip"); TestManager.AssertEquals(stack.GetChipMetaAt(4).prefabId, 15, "Wrong prefabid"); }
public void TestRemoveChip() { StackMeta stack = GetStackMetaOf5(); Debug.Log("stack: " + stack.ToStringShort()); int initalCount = 5; ChipMeta chip = stack.GetChipMetaAt(initalCount - 1); stack.RemoveAt(stack.ChipCount() - 1); TestManager.AssertEquals(stack.ChipCount(), initalCount - 1, "TestRemoveChip"); chip = stack.GetChipMetaAt(2); stack.RemoveAt(2); for (int i = 0; i < stack.ChipCount(); i++) { ChipMeta chipI = stack.GetChipMetaAt(i); stack.RemoveAt(i); TestManager.AssertEquals(i, chipI.stackPos, "TestRemoveChip stack pos is not the same"); } }