public void Constants()
{
var eps = Turn.OneTurnClockwise*0.00001;
var pp = Dir.FromVector(1, 1);
var pn = Dir.FromVector(1, -1);
var np = Dir.FromVector(-1, 1);
var nn = Dir.FromVector(-1, -1);
var px = Dir.AlongPositiveX;
var py = Dir.AlongPositiveY;
var nx = Dir.AlongNegativeX;
var ny = Dir.AlongNegativeY;
Action<Range, Dir?, Dir?, Dir[]> check = (range, cc, c, contents) => {
foreach (var e in new[] {pp, pn, np, nn, px, py, nx, ny}) {
Assert.IsTrue(range.Contains(e) == contents.Contains(e));
}
if (cc != null && c != null) {
Assert.IsTrue(range.CounterClockwiseSide.Equals(cc.Value));
Assert.IsTrue(range.Side(clockwiseSide: false).Equals(cc.Value));
Assert.IsTrue(range.ClockwiseSide.Equals(c.Value));
Assert.IsTrue(range.Side(clockwiseSide: true).Equals(c.Value));
Assert.IsTrue(range.Span == (cc.Value - c.Value).MinimumCongruentCounterClockwiseTurn());
Assert.IsTrue(range.Center.Equals(c.Value + (cc.Value - c.Value).MinimumCongruentCounterClockwiseTurn() / 2, eps));
}
};
check(Range.AllDirections, null, null, new[] { pp, pn, np, nn, px, py, nx, ny });
check(Range.PositiveX, py, ny, new[] { pp, pn, py, ny, px });
check(Range.PositiveY, nx, px, new[] { pp, np, py, nx, px });
check(Range.PositiveXPositiveY, py, px, new[] { pp, px, py });
check(Range.PositiveXNegativeY, px, ny, new[] { pn, px, ny });
check(Range.NegativeXPositiveY, nx, py, new[] { np, nx, py });
check(Range.NegativeXNegativeY, ny, nx, new[] { nn, nx, ny });
}