3 int test_MI_plus (int iterations)
7 // Check commutativity.
8 for (i = iterations; i > 0; i--) {
9 cl_I m = testrandom_I();
10 cl_modint_ring R = find_modint_ring(m);
11 cl_MI a = R->canonhom(testrandom_I());
12 cl_MI b = R->canonhom(testrandom_I());
13 ASSERT3(a+b == b+a, m,a,b);
15 // Check associativity.
16 for (i = iterations; i > 0; i--) {
17 cl_I m = testrandom_I();
18 cl_modint_ring R = find_modint_ring(m);
19 cl_MI a = R->canonhom(testrandom_I());
20 cl_MI b = R->canonhom(testrandom_I());
21 cl_MI c = R->canonhom(testrandom_I());
22 ASSERT4((a+b)+c == a+(b+c), m,a,b,c);
24 // Check special case 0.
25 for (i = iterations; i > 0; i--) {
26 cl_I m = testrandom_I();
27 cl_modint_ring R = find_modint_ring(m);
28 cl_MI a = R->canonhom(testrandom_I());
30 ASSERT2(a+z == a, m,a);