public void can_get_componenets() { var v = new VectorF(new[] { 3.0f, 4.0f, 5.0f }); Assert.Equal(3.0, v.Get(0)); Assert.Equal(4.0, v.Get(1)); Assert.Equal(5.0, v.Get(2)); }
public void get_large_dimension_throws() { var v = new VectorF(5); Assert.Throws <ArgumentOutOfRangeException>(() => v.Get(5)); Assert.Throws <ArgumentOutOfRangeException>(() => v.Get(6)); Assert.Throws <ArgumentOutOfRangeException>(() => v.Get(101)); Assert.Throws <ArgumentOutOfRangeException>(() => v.Get(int.MaxValue)); }
public void get_negative_dimension_throws() { var v = new VectorF(5); Assert.Throws <ArgumentOutOfRangeException>(() => v.Get(-1)); Assert.Throws <ArgumentOutOfRangeException>(() => v.Get(-4)); Assert.Throws <ArgumentOutOfRangeException>(() => v.Get(-5)); Assert.Throws <ArgumentOutOfRangeException>(() => v.Get(int.MinValue)); }
public void can_set_componenets() { var v = new VectorF(new[] { 2.0f, 6.0f, 7.0f }); v.Set(0, 3.0f); v.Set(1, 4.0f); v.Set(2, 5.0f); Assert.Equal(3.0, v.Get(0)); Assert.Equal(4.0, v.Get(1)); Assert.Equal(5.0, v.Get(2)); }
public void get_all_element_for_dim_5() { var v = new VectorF(5); v.Set(0, -1.0f); v.Set(1, 5.7f); v.Set(2, -0.4f); v.Set(3, 9.0f); v.Set(4, -101.1f); Assert.Equal(-1.0f, v.Get(0)); Assert.Equal(5.7f, v.Get(1)); Assert.Equal(-0.4f, v.Get(2)); Assert.Equal(9.0f, v.Get(3)); Assert.Equal(-101.1f, v.Get(4)); }
public void size_constructor_sets_components_to_zero() { var v = new VectorF(15); Assert.Equal(15, v.Dimensions); for (var d = 0; d < v.Dimensions; d++) { Assert.Equal(0.0, v.Get(d)); } }