added check for power::get_free_indices()
authorChristian Bauer <Christian.Bauer@uni-mainz.de>
Mon, 2 Aug 2004 21:40:04 +0000 (21:40 +0000)
committerChristian Bauer <Christian.Bauer@uni-mainz.de>
Mon, 2 Aug 2004 21:40:04 +0000 (21:40 +0000)
check/exam_indexed.cpp

index 3d9b307..e20b564 100644 (file)
@@ -375,6 +375,15 @@ static unsigned dummy_check()
        e = indexed(p, mu.toggle_variance(), mu) - indexed(p, nu, nu.toggle_variance());
        result += check_equal_simplify(e, 0);
 
+       // GiNaC 1.2.1 had a bug here because p.i*p.i -> (p.i)^2
+       e = indexed(p, i) * indexed(p, i) * indexed(p, j) + indexed(p, j);
+       ex fi = exprseq(e.get_free_indices());
+       if (!fi.is_equal(exprseq(j))) {
+               clog << "get_free_indices(" << e << ") erroneously returned "
+                    << fi << " instead of (.j)" << endl;
+               ++result;
+       }
+
        return result;
 }