public void DoubleLeftRotateTest( [Random(-10000, 10000, 5)] int x, [Random(-10000, 10000, 5)] int y) { // Arrange var point = new HexPoint(x, y); var expectedPoint = HexPoint.RotateLeft(HexPoint.RotateLeft(point)); // Act point = HexPoint.RotateLeft120(point); // Assert Assert.AreEqual(expectedPoint, point); }
public void LeftRotateTest( [ValueSource("s_ValidPoints")] TestHexPoint source, [ValueSource("s_LeftRotatedValidPoints")] TestHexPoint expected) { // Arrange var point = new HexPoint(source.x, source.y); var expectedPoint = new HexPoint(expected.x, expected.y); // Act point = HexPoint.RotateLeft(point); // Assert Assert.AreEqual(expectedPoint, point); }
public void RightLeftRotateIdentity( [Random(-10000, 10000, 5)] int x, [Random(-10000, 10000, 5)] int y) { // Arrange var point = new HexPoint(x, y); var expectedPoint = new HexPoint(x, y); // Act point = HexPoint.RotateRight(point); point = HexPoint.RotateLeft(point); // Assert Assert.AreEqual(expectedPoint, point); }
public void TripleRotateTest( [Random(-10000, 10000, 5)] int x, [Random(-10000, 10000, 5)] int y) { // Arrange var pointA = new HexPoint(x, y); var pointB = new HexPoint(x, y); var expectedPoint = HexPoint.Rotate180(new HexPoint(x, y)); // Act pointA = HexPoint.RotateLeft(HexPoint.RotateLeft(HexPoint.RotateLeft(pointA))); pointB = HexPoint.RotateRight(HexPoint.RotateRight(HexPoint.RotateRight(pointB))); // Assert Assert.AreEqual(expectedPoint, pointA); Assert.AreEqual(expectedPoint, pointB); }
public void DoubleLeftOffsetRotateTest( [Random(-10000, 10000, 25)] int x, [Random(-10000, 10000, 25)] int y, [Random(-10000, 10000, 25)] int offsetX, [Random(-10000, 10000, 25)] int offsetY) { // Arrange var point = new HexPoint(x, y); var offsetPoint = new HexPoint(offsetX, offsetY); var expectedPoint = HexPoint.RotateLeft(HexPoint.RotateLeft(point, offsetPoint), offsetPoint); // Act point = HexPoint.RotateLeft120(point, offsetPoint); // Assert Assert.AreEqual(expectedPoint, point); }
public void OffsetRightLeftRotateIdentity( [Random(-10000, 10000, 25)] int x, [Random(-10000, 10000, 25)] int y, [Random(-10000, 10000, 25)] int offsetX, [Random(-10000, 10000, 25)] int offsetY) { // Arrange var point = new HexPoint(x, y); var expectedPoint = new HexPoint(x, y); var offsetPoint = new HexPoint(offsetX, offsetY); // Act point = HexPoint.RotateRight(point, offsetPoint); point = HexPoint.RotateLeft(point, offsetPoint); // Assert Assert.AreEqual(expectedPoint, point); }