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

Function TestMatrixScaleComponent

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

Source from the content-addressed store, hash-verified

1172}
1173
1174func TestMatrixScaleComponent(t *testing.T) {
1175 data := []struct {
1176 matrix []float32
1177 expectedX, expectedY float32
1178 }{
1179 {
1180 matrix: []float32{
1181 0, 0, 0,
1182 0, 0, 0,
1183 0, 0, 0,
1184 },
1185 expectedX: 0,
1186 expectedY: 0,
1187 },
1188 {
1189 matrix: []float32{
1190 1, 2, 3,
1191 3, 1, 2,
1192 2, 3, 1,
1193 },
1194 expectedX: 1,
1195 expectedY: 1,
1196 },
1197 {
1198 matrix: []float32{
1199 5, 2, 3,
1200 6, -4, 3,
1201 1, 4, 2,
1202 },
1203 expectedX: 5,
1204 expectedY: -4,
1205 },
1206 {
1207 matrix: []float32{
1208 -5, 2, 3,
1209 6, -4, 3,
1210 1, 4, 2,
1211 },
1212 expectedX: -5,
1213 expectedY: -4,
1214 },
1215 }
1216 for _, d := range data {
1217 mat1 := IdentityMatrix()
1218 mat1.Set(d.matrix)
1219 if resX, resY := mat1.ScaleComponent(); !FloatEqual(resX, d.expectedX) || !FloatEqual(resY, d.expectedY) {
1220 t.Errorf("Scale Component did not match expected!\n ResX: %v\n expectedX: %v\n ResY: %v\n expectedY: %v\n", resX, d.expectedX, resY, d.expectedY)
1221 return
1222 }
1223 }
1224}
1225
1226func TestMatrixTranslationComponent(t *testing.T) {
1227 data := []struct {

Callers

nothing calls this directly

Calls 4

IdentityMatrixFunction · 0.85
FloatEqualFunction · 0.85
ScaleComponentMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected