MCPcopy Create free account
hub / github.com/cogentcore/core / TestMatrix2String

Function TestMatrix2String

math32/matrix2_test.go:97–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

95}
96
97func TestMatrix2String(t *testing.T) {
98 tests := []struct {
99 matrix Matrix2
100 want string
101 }{
102 {
103 matrix: Identity2(),
104 want: "none",
105 },
106 {
107 matrix: Matrix2{XX: 1, YX: 2, XY: 3, YY: 4, X0: 5, Y0: 6},
108 want: "matrix(1,2,3,4,5,6)",
109 },
110 {
111 matrix: Matrix2{XX: 2, XY: 0, YX: 0, YY: 2, X0: 0, Y0: 0},
112 want: "scale(2,2)",
113 },
114 {
115 matrix: Matrix2{XX: 1, XY: 0, YX: 0, YY: 1, X0: 1, Y0: 2},
116 want: "translate(1,2)",
117 },
118 {
119 matrix: Matrix2{XX: 2, XY: 0, YX: 0, YY: 2, X0: 1, Y0: 2},
120 want: "translate(1,2) scale(2,2)",
121 },
122 }
123
124 for _, tt := range tests {
125 got := tt.matrix.String()
126 assert.Equal(t, tt.want, got)
127 }
128}

Callers

nothing calls this directly

Calls 3

Identity2Function · 0.85
EqualMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected