@Test public void test1() { GeneralIndicesInsertion gii = new GeneralIndicesInsertion(); gii.addInsertionRule(parseSimple("A^a'_b'"), Matrix1); gii.addInsertionRule(parseSimple("B^a'_b'"), Matrix1); gii.addInsertionRule(parseSimple("C^a'_b'"), Matrix1); gii.addInsertionRule(parseSimple("cv_b'"), Matrix1); gii.addInsertionRule(parseSimple("v^b'"), Matrix1); CC.current().getParseManager().defaultParserPreprocessors.add(gii); Tensor t, exp; t = parse("A*B*C"); exp = parse("C*B*A"); TAssert.assertEquals(inverseOrderOfMatrices(t, Matrix1), exp); t = parse("cv*A*B*C"); exp = parse("cv*C*B*A"); TAssert.assertEquals(inverseOrderOfMatrices(t, Matrix1), exp); t = parse("A*B*C*v"); exp = parse("C*B*A*v"); TAssert.assertEquals(inverseOrderOfMatrices(t, Matrix1), exp); t = parse("cv*A*B*C*v"); exp = parse("cv*C*B*A*v"); TAssert.assertEquals(inverseOrderOfMatrices(t, Matrix1), exp); }