public void subtracting_null_vector_throws() { var left = new VectorF(3); VectorF right = null; Assert.Throws <ArgumentNullException>(() => left.Subtract(right)); }
public void subtracting_vectors_of_different_size_throws() { var left = new VectorF(3); var right = new VectorF(4); Assert.NotEqual(left.Dimensions, right.Dimensions); Assert.Throws <ArgumentOutOfRangeException>(() => left.Subtract(right)); }
public void subtracting_vectors_leaves_right_unchanged() { var left = new VectorF(3); left.Set(0, 1); left.Set(1, 10); left.Set(2, 6); var right = new VectorF(3); right.Set(0, 10); right.Set(1, 3); right.Set(2, 1); var expectedRight = new VectorF(right); left.Subtract(right); Assert.Equal(expectedRight, right); }
public void subtracting_vector_subtracts_from_components() { var actual = new VectorF(3); actual.Set(0, 1); actual.Set(1, 10); actual.Set(2, 6); var right = new VectorF(3); right.Set(0, 10); right.Set(1, 3); right.Set(2, 1); var expected = new VectorF(3); expected.Set(0, -9); expected.Set(1, 7); expected.Set(2, 5); actual.Subtract(right); Assert.Equal(expected, actual); }