(t *testing.T)
| 1224 | } |
| 1225 | |
| 1226 | func TestMatrixTranslationComponent(t *testing.T) { |
| 1227 | data := []struct { |
| 1228 | matrix []float32 |
| 1229 | expectedX, expectedY float32 |
| 1230 | }{ |
| 1231 | { |
| 1232 | matrix: []float32{ |
| 1233 | 0, 0, 0, |
| 1234 | 0, 0, 0, |
| 1235 | 0, 0, 0, |
| 1236 | }, |
| 1237 | expectedX: 0, |
| 1238 | expectedY: 0, |
| 1239 | }, |
| 1240 | { |
| 1241 | matrix: []float32{ |
| 1242 | 1, 2, 3, |
| 1243 | 4, 5, 6, |
| 1244 | 7, 8, 9, |
| 1245 | }, |
| 1246 | expectedX: 7, |
| 1247 | expectedY: 8, |
| 1248 | }, |
| 1249 | { |
| 1250 | matrix: []float32{ |
| 1251 | 5, 2, 3, |
| 1252 | 6, -4, 3, |
| 1253 | 1, -4, 2, |
| 1254 | }, |
| 1255 | expectedX: 1, |
| 1256 | expectedY: -4, |
| 1257 | }, |
| 1258 | { |
| 1259 | matrix: []float32{ |
| 1260 | -5, 2, 3, |
| 1261 | 6, -4, 3, |
| 1262 | -1, 4, 2, |
| 1263 | }, |
| 1264 | expectedX: -1, |
| 1265 | expectedY: 4, |
| 1266 | }, |
| 1267 | } |
| 1268 | for _, d := range data { |
| 1269 | mat1 := IdentityMatrix() |
| 1270 | mat1.Set(d.matrix) |
| 1271 | if resX, resY := mat1.TranslationComponent(); !FloatEqual(resX, d.expectedX) || !FloatEqual(resY, d.expectedY) { |
| 1272 | t.Errorf("Translation Component did not match expected!\n Matrix: %v\n ResX: %v\n expectedX: %v\n ResY: %v\n expectedY: %v\n", d.matrix, resX, d.expectedX, resY, d.expectedY) |
| 1273 | return |
| 1274 | } |
| 1275 | } |
| 1276 | } |
| 1277 | |
| 1278 | func TestMatrixRotationComponent(t *testing.T) { |
| 1279 | data := []struct { |
nothing calls this directly
no test coverage detected