public static void value_value_distance() { var op = new PeriodicOperations(-180, 360); Assert.Equal(10, op.Distance(50, 60)); Assert.Equal(10, op.Distance(60, 50)); Assert.Equal(20, op.Distance(170, -170)); Assert.Equal(20, op.Distance(-170, 170)); }
public static void determine_range_value_distance() { var op = new PeriodicOperations(0, 5); Assert.Equal(0, op.Distance(0, 2, 0)); Assert.Equal(0, op.Distance(0, 2, 1)); Assert.Equal(0, op.Distance(0, 2, 2)); Assert.Equal(0, op.Distance(0, 2, 5)); Assert.Equal(0, op.Distance(0, 1, 0)); Assert.Equal(0, op.Distance(0, 1, 1)); Assert.Equal(1, op.Distance(0, 1, 2)); Assert.Equal(0, op.Distance(0, 1, 5)); Assert.Equal(1, op.Distance(1, 3, 0)); Assert.Equal(0, op.Distance(1, 3, 2)); Assert.Equal(1, op.Distance(1, 3, 4)); Assert.Equal(0, op.Distance(2, 0, 0)); Assert.Equal(1, op.Distance(2, 0, 1)); Assert.Equal(0, op.Distance(2, 0, 2)); Assert.Equal(0, op.Distance(2, 0, 5)); Assert.Equal(0, op.Distance(1, 0, 0)); Assert.Equal(0, op.Distance(1, 0, 1)); Assert.Equal(0, op.Distance(1, 0, 2)); Assert.Equal(0, op.Distance(1, 0, 5)); Assert.Equal(0, op.Distance(3, 1, 0)); Assert.Equal(1, op.Distance(3, 1, 2)); Assert.Equal(0, op.Distance(3, 1, 4)); }