def test_create_identity_matrix(self): m = create_identity_matrix(2); self.assertEqual(m.size.height, 2) self.assertEqual(m.size.width, 2) self.assertEqual(m.get(1, 1), 1) self.assertEqual(m.get(1, 2), 0) self.assertEqual(m.get(2, 1), 0) self.assertEqual(m.get(2, 2), 1)
def test_multiplication_with_identity_matrix(self): # a * I = a a = parse_matrix("1 2 3;4 5 6;7 8 9") I = create_identity_matrix(3) self.assertEqual(a, a * I) self.assertEqual(a, I * a)