]> www.ginac.de Git - ginac.git/blob - check/lsolve_onedim.cpp
Another restructuring: moved include/*.h -> include/GiNaC/*.h in order to
[ginac.git] / check / lsolve_onedim.cpp
1 // check/lsolve_onedim.cpp
2
3 /* This test routine does some simple checks on solving a polynomial for a
4  * variable. */
5
6 #include <GiNaC/ginac.h>
7
8 unsigned lsolve_onedim(void)
9 {
10     unsigned result = 0;
11     symbol x("x");
12     ex eq, aux;
13     
14     cout << "checking linear solve..." << flush;
15     clog << "---------linear solve:" << endl;
16     
17     eq = (3*x+5 == numeric(8));
18     aux = lsolve(eq,x);
19     if (aux != 1) {
20         result++;
21         clog << "solution of 3*x+5==8 erroneously returned "
22              << aux << endl;
23     }
24     
25     if (! result) {
26         cout << " passed ";
27         clog << "(no output)" << endl;
28     } else {
29         cout << " failed ";
30     }
31     
32     return result;
33 }