public void SingleZero() { var unit = new Unit(new Cell[] { new Cell(0, 0) }, new Cell(0, 0)); for (int rotation = 0; rotation < 6; ++rotation) { Cell[] cells = unit.GetRotatedCells(rotation); Assert.AreEqual(1, cells.Length); Assert.AreEqual(cells[0], new Cell(0, 0)); Assert.AreEqual(0, unit.GetCanonicalRotation(rotation)); } }
public void SingleShiftedPivot() { var unit = new Unit(new Cell[] { new Cell(1, 5) }, new Cell(4, 5)); for (int rotation = 0; rotation < 6; ++rotation) { Cell[] cells = unit.GetRotatedCells(rotation); Assert.AreEqual(1, cells.Length); Assert.AreEqual(rotation, unit.GetCanonicalRotation(rotation)); } Assert.AreEqual(unit.GetRotatedCells(0)[0], new Cell(1, 5)); Assert.AreEqual(unit.GetRotatedCells(1)[0], new Cell(3, 8)); Assert.AreEqual(unit.GetRotatedCells(2)[0], new Cell(6, 8)); Assert.AreEqual(unit.GetRotatedCells(3)[0], new Cell(7, 5)); Assert.AreEqual(unit.GetRotatedCells(4)[0], new Cell(6, 2)); Assert.AreEqual(unit.GetRotatedCells(5)[0], new Cell(3, 2)); }
public void Symmetry() { var unit = new Unit(new Cell[] { new Cell(2, 0), new Cell(0, 0) }, new Cell(1, 0)); Assert.AreEqual(new Cell(0, 0), unit.GetRotatedCells(0)[0]); Assert.AreEqual(new Cell(2, 0), unit.GetRotatedCells(0)[1]); Assert.AreEqual(0, unit.GetCanonicalRotation(0)); Assert.AreEqual(new Cell(1, -1), unit.GetRotatedCells(1)[0]); Assert.AreEqual(new Cell(0, 1), unit.GetRotatedCells(1)[1]); Assert.AreEqual(1, unit.GetCanonicalRotation(1)); Assert.AreEqual(new Cell(0, -1), unit.GetRotatedCells(2)[0]); Assert.AreEqual(new Cell(1, 1), unit.GetRotatedCells(2)[1]); Assert.AreEqual(2, unit.GetCanonicalRotation(2)); Assert.AreEqual(new Cell(0, 0), unit.GetRotatedCells(3)[0]); Assert.AreEqual(new Cell(2, 0), unit.GetRotatedCells(3)[1]); Assert.AreEqual(0, unit.GetCanonicalRotation(3)); Assert.AreEqual(new Cell(1, -1), unit.GetRotatedCells(4)[0]); Assert.AreEqual(new Cell(0, 1), unit.GetRotatedCells(4)[1]); Assert.AreEqual(1, unit.GetCanonicalRotation(4)); Assert.AreEqual(new Cell(0, -1), unit.GetRotatedCells(5)[0]); Assert.AreEqual(new Cell(1, 1), unit.GetRotatedCells(5)[1]); Assert.AreEqual(2, unit.GetCanonicalRotation(5)); }