@@ -22,9 +22,12 @@ func TestMultiplyByScalar(t *testing.T) {
22
22
}
23
23
24
24
func TestLength (t * testing.T ) {
25
- assert .Equal (t , 3. , Vector {3. , 0. , 0. }.Length (), "calculates the length(magnitude) correctly for Vector{3., 0., 0.}" )
26
- assert .Equal (t , 6. , Vector {6. , 0. , 0. }.Length (), "calculates the length(magnitude) correctly for Vector{6., 0., 0.}" )
27
- assert .Equal (t , 6.324555320336759 , Vector {6. , 2. , 0. }.Length (), "calculates the length(magnitude) correctly for Vector{6., 2., 0.}" )
25
+ assert .Equal (t , 3. , Vector {3. , 0. , 0. }.Length (),
26
+ "calculates the length(magnitude) correctly for Vector{3., 0., 0.}" )
27
+ assert .Equal (t , 6. , Vector {6. , 0. , 0. }.Length (),
28
+ "calculates the length(magnitude) correctly for Vector{6., 0., 0.}" )
29
+ assert .Equal (t , 6.324555320336759 , Vector {6. , 2. , 0. }.Length (),
30
+ "calculates the length(magnitude) correctly for Vector{6., 2., 0.}" )
28
31
}
29
32
30
33
func TestDotProductOfTwoPerpendicularVectors (t * testing.T ) {
@@ -39,11 +42,15 @@ func TestDotProductOfTwoParallelVectors(t *testing.T) {
39
42
40
43
func TestCrossProduct (t * testing.T ) {
41
44
result := Vector {1. , 0. , 0. }.Cross (Vector {0. , 1. , 0. })
42
- assert .Equal (t , Vector {0. , 0. , 1. }, result , "cross product returns a vector perpendicular to the other two" )
45
+ assert .Equal (t , Vector {0. , 0. , 1. }, result ,
46
+ "cross product returns a vector perpendicular to the other two" )
43
47
}
44
48
45
49
func TestNormalize (t * testing.T ) {
46
- assert .Equal (t , Vector {1. , 0. , 0. }, Vector {10. , 0. , 0. }.Normalize (), "returns a unit vector (versor) from the given vector" )
47
- assert .Equal (t , Vector {0. , 1. , 0. }, Vector {0. , 10. , 0. }.Normalize (), "returns a unit vector (versor) from the given vector" )
48
- assert .Equal (t , Vector {0. , 0. , 1. }, Vector {0. , 0. , 10. }.Normalize (), "returns a unit vector (versor) from the given vector" )
50
+ assert .Equal (t , Vector {1. , 0. , 0. }, Vector {10. , 0. , 0. }.Normalize (),
51
+ "returns a unit vector (versor) from the given vector" )
52
+ assert .Equal (t , Vector {0. , 1. , 0. }, Vector {0. , 10. , 0. }.Normalize (),
53
+ "returns a unit vector (versor) from the given vector" )
54
+ assert .Equal (t , Vector {0. , 0. , 1. }, Vector {0. , 0. , 10. }.Normalize (),
55
+ "returns a unit vector (versor) from the given vector" )
49
56
}
0 commit comments