MCPcopy
hub / github.com/EngoEngine/engo / TestMatrixSet

Function TestMatrixSet

math_test.go:772–794  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

770}
771
772func TestMatrixSet(t *testing.T) {
773 m := IdentityMatrix()
774 for i := 0; i < 9; i++ {
775 exp := float32(0)
776 if i == 0 || i == 4 || i == 8 {
777 exp = 1
778 }
779 if !FloatEqual(m.Val[i], exp) {
780 t.Errorf("Identity was not the identity matrix. Index: %v\n Wanted: %v\n Got: %v\n", i, exp, m.Val[i])
781 }
782 }
783 set := []float32{
784 2, 3, 4,
785 3, 4, 5,
786 4, 5, 6,
787 }
788 m.Set(set)
789 for i := 0; i < 9; i++ {
790 if !FloatEqual(set[i], m.Val[i]) {
791 t.Errorf("Set did not set properly. Index: %v\n Wanted: %v\n Got: %v\n", i, set[i], m.Val[i])
792 }
793 }
794}
795
796func TestMatrixMultiply(t *testing.T) {
797 data := []struct {

Callers

nothing calls this directly

Calls 3

IdentityMatrixFunction · 0.85
FloatEqualFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected