]> www.ginac.de Git - ginac.git/commitdiff
- Add Denny-Fliegner test.
authorRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Tue, 2 Jan 2001 17:48:50 +0000 (17:48 +0000)
committerRichard Kreckel <Richard.Kreckel@uni-mainz.de>
Tue, 2 Jan 2001 17:48:50 +0000 (17:48 +0000)
cint/exam_misc.cpp

index d237e97eb9f40cb04f6f28a6e4cd6214d1784245..b499364e98583834a708599015d2a26a4732b87c 100755 (executable)
@@ -1,11 +1,33 @@
 #! ./run_exams --silent
 unsigned result = 0;
+/*
+ * A simple substitution test.  If it fails you are really in trouble:
+ */
 {
-    symbol a("a"), b("b");
-    ex e, f;
-    e = pow(a+b,200).expand();
-    f = e.subs(a == -b);
-    if (f != 0)
-        ++result;
+       symbol x("x"), y("y");
+       ex e, f;
+       e = pow(x+y,200).expand();
+       f = e.subs(x == -y);
+       if (f != 0)
+               ++result;
+}
+/*
+ * Denny Fliegner's test using vector<symbol> is rather hard on Cint.  If
+ * it fails due to missing <sstream> it's due to your compiler not being
+ * fully ANSI-compliant.  Don't worry.
+ */
+#include <sstream>
+{
+       vector<symbol> a;
+       ex bigsum = 0;
+       for (int i=0; i<42; ++i) {
+        ostringstream buf;
+        buf << "a" << i << ends;
+        a.push_back(symbol(buf.str()));
+        bigsum += a[i];
+       }
+       ex sbtrct = -bigsum + a[0] + a[1];
+       if (pow(bigsum,2).expand().subs(a[0]==sbtrct).expand() != pow(a[1],2))
+               ++result;
 }
 exit(result);