public void wrong_size_throws() { var a = new VectorF(5); var b = new VectorF(3); Assert.Throws <ArgumentOutOfRangeException>(() => a.GetDistance(b)); }
public void zero_lengths_have_zero_distance() { var a = new VectorF(0); var b = new VectorF(0); var expected = 0.0; var actual = a.GetDistance(b); Assert.Equal(expected, actual); }
public void can_find_distance_in_both_directions() { var a = new VectorF(5); a.Set(0, 1); a.Set(1, 2); a.Set(2, 3); var b = new VectorF(5); b.Set(1, -9); b.Set(2, 5); b.Set(4, 3); var expected = a.GetDistance(b); var actual = b.GetDistance(a); Assert.Equal(expected, actual); }
public void can_find_distance() { var a = new VectorF(5); a.Set(0, 1); a.Set(1, 2); a.Set(2, 3); var b = new VectorF(5); b.Set(1, -9); b.Set(2, 5); b.Set(3, 2); b.Set(4, 3); var expected = (float)Math.Sqrt(139.0); var actual = a.GetDistance(b); Assert.Equal(expected, actual); }
public void null_vector_throws() { var a = new VectorF(5); Assert.Throws <ArgumentNullException>(() => a.GetDistance((VectorF)null)); }