Skip to content

Commit d3befec

Browse files
committed
add test for new matrix MulScalar func
1 parent f38447a commit d3befec

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/MeshTypes/matrix_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@ func TestIdentityMatrix(t *testing.T) {
1919
}
2020
}
2121

22+
func TestMulScalar(t *testing.T) {
23+
a := MeshTypes.Matrix{
24+
X00: 1, X01: 2, X02: 3, X03: 4,
25+
X10: 5, X11: 6, X12: 7, X13: 8,
26+
X20: 9, X21: 10, X22: 11, X23: 12,
27+
X30: 13, X31: 14, X32: 15, X33: 16,
28+
}
29+
want := MeshTypes.Matrix{
30+
X00: 3, X01: 6, X02: 9, X03: 12,
31+
X10: 15, X11: 18, X12: 21, X13: 24,
32+
X20: 27, X21: 30, X22: 33, X23: 36,
33+
X30: 39, X31: 42, X32: 45, X33: 48,
34+
}
35+
result := a.MulScalar(3)
36+
if !reflect.DeepEqual(result, want) {
37+
t.Errorf(`Matrix Scalar Multiplication Output does not match`)
38+
}
39+
}
40+
2241
func TestMatrixMul(t *testing.T) {
2342
a := MeshTypes.Matrix{
2443
X00: 1, X01: 2, X02: 3, X03: 4,

0 commit comments

Comments
 (0)