Line data Source code
1 : #include <stdio.h> 2 : #include "poly.h" 3 : 4 2 : static void poly_test(const char* a, const char* b) 5 : { 6 : poly_t* p; 7 : poly_t* q; 8 : poly_t* r; 9 : 10 2 : printf("Begin polynomial test of (%s) * (%s)\n", a, b); 11 : 12 2 : p = new_poly_from_string(a); 13 2 : q = new_poly_from_string(b); 14 : 15 2 : print_poly(p); 16 2 : print_poly(q); 17 : 18 2 : r = mul(p, q); 19 : 20 2 : print_poly(r); 21 : 22 2 : free_poly(p); 23 2 : free_poly(q); 24 2 : free_poly(r); 25 : 26 2 : printf("End polynomial test of (%s) * (%s)\n", a, b); 27 2 : } 28 : 29 1 : int main(void) 30 : { 31 1 : poly_test("x^2 - 7x + 1", "3x + 2"); 32 1 : putchar('\n'); 33 1 : poly_test("x^10000000 + 2", "2x^2 + 3x + 4"); 34 : 35 1 : return 0; 36 : }