]> www.ginac.de Git - ginac.git/blob - cint/exam_misc.cpp
- Add Denny-Fliegner test.
[ginac.git] / cint / exam_misc.cpp
1 #! ./run_exams --silent
2 unsigned result = 0;
3 /*
4  * A simple substitution test.  If it fails you are really in trouble:
5  */
6 {
7         symbol x("x"), y("y");
8         ex e, f;
9         e = pow(x+y,200).expand();
10         f = e.subs(x == -y);
11         if (f != 0)
12                 ++result;
13 }
14 /*
15  * Denny Fliegner's test using vector<symbol> is rather hard on Cint.  If
16  * it fails due to missing <sstream> it's due to your compiler not being
17  * fully ANSI-compliant.  Don't worry.
18  */
19 #include <sstream>
20 {
21         vector<symbol> a;
22         ex bigsum = 0;
23         for (int i=0; i<42; ++i) {
24         ostringstream buf;
25         buf << "a" << i << ends;
26         a.push_back(symbol(buf.str()));
27         bigsum += a[i];
28         }
29         ex sbtrct = -bigsum + a[0] + a[1];
30         if (pow(bigsum,2).expand().subs(a[0]==sbtrct).expand() != pow(a[1],2))
31                 ++result;
32 }
33 exit(result);