]> www.ginac.de Git - ginac.git/blob - cint/exam_misc.cpp
* basic::collec() never worked correctly on non-polynomials till now.
[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> tests Cint's memory management.
16  */
17 #include <sstream>
18 {
19         vector<symbol> a;
20         ex bigsum = 0;
21         for (int i=0; i<42; ++i) {
22                 ostringstream buf;
23                 buf << "a" << i << ends;
24                 a.push_back(symbol(buf.str()));
25                 bigsum += a[i];
26         }
27         ex sbtrct = -bigsum + a[0] + a[1];
28         if (pow(bigsum,2).expand().subs(a[0]==sbtrct).expand() != pow(a[1],2))
29                 ++result;
30 }
31 exit(result);