6 static unsigned exam_collect_common_factors_simple()
9 symbol a("a"), b("b"), c("c"), x("x"), y("y");
13 ef = collect_common_factors(ei);
16 clog << "ERROR: collect_common_factors(" << ei << ") returned "
17 << ef << ", not " << ref << '.' << endl;
21 ei = a*x*x + 2*a*x*y + a*y*y;
22 ef = collect_common_factors(ei);
23 ref = a*(x*x + 2*x*y + y*y);
25 clog << "ERROR: collect_common_factors(" << ei << ") returned "
26 << ef << ", not " << ref << '.' << endl;
33 static unsigned exam_collect_common_factors_zero()
35 // r = 0 = c*0 = c*(x + 1 - 1 - x) = c*(x + 1) - c - c*x
37 symbol a("a"), b("b"), c("c"), x("x");
39 ex r = c*(x+1) - c - c*x;
41 ex ef = collect_common_factors(ei);
43 clog << "ERROR: " << ei << " should be 0, got " << ef << " instead." << endl;
49 int main(int argc, char** argv)
53 cout << "examining collect_common_factors" << flush;
55 result += exam_collect_common_factors_simple(); cout << '.' << flush;
56 result += exam_collect_common_factors_zero(); cout << '.' << flush;