/**
* Tests matrix inversion and multiplication using {@link Matrix2}.
*/
@Test
public void testMatrix2() {
final Matrix2 m = new Matrix2();
assertTrue(m.isAffine());
assertTrue(m.isIdentity());
final Random random = new Random(8447482612423035360L);
final GeneralMatrix identity = new GeneralMatrix(2);
for (int i=0; i<100; i++) {
m.setElement(0,0, 100*random.nextDouble());
m.setElement(0,1, 100*random.nextDouble());
m.setElement(1,0, 100*random.nextDouble());
m.setElement(1,1, 100*random.nextDouble());
final Matrix2 original = m.clone();
final GeneralMatrix check = new GeneralMatrix(m);
m.invert();
check.invert();
assertTrue(check.equals(m, 1E-9));
m.multiply(original);