3 int test_I_mul (int iterations)
7 // Check commutativity.
8 for (i = iterations; i > 0; i--) {
9 cl_I a = testrandom_I();
10 cl_I b = testrandom_I();
11 ASSERT2(a*b == b*a, a,b);
13 // Check associativity.
14 for (i = iterations; i > 0; i--) {
15 cl_I a = testrandom_I();
16 cl_I b = testrandom_I();
17 cl_I c = testrandom_I();
18 ASSERT3((a*b)*c == a*(b*c), a,b,c);
20 // Check second binomial formula.
21 for (i = iterations; i > 0; i--) {
22 cl_I a = testrandom_I();
23 cl_I b = testrandom_I();
24 ASSERT2((a+b)*(a-b) == a*a-b*b, a,b);
26 // Check distributive formula.
27 for (i = iterations; i > 0; i--) {
28 cl_I a = testrandom_I();
29 cl_I b = testrandom_I();
30 cl_I c = testrandom_I();
31 ASSERT3((a+c)*(b+c) == a*b+(a+b)*c+c*c, a,b,c);
33 // Check special cases 0, 1, -1.
34 for (i = iterations; i > 0; i--) {
35 cl_I a = testrandom_I();
38 ASSERT1(a*-1 == -a, a);