3 int test_MI_minus (int iterations)
7 // Check anti-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());
14 ASSERT3((a-b) + (b-a) == z, m,a,b);
16 // Check associativity.
17 for (i = iterations; i > 0; i--) {
18 cl_I m = testrandom_I();
19 cl_modint_ring R = find_modint_ring(m);
20 cl_MI a = R->canonhom(testrandom_I());
21 cl_MI b = R->canonhom(testrandom_I());
22 cl_MI c = R->canonhom(testrandom_I());
23 ASSERT4(a-(b-c) == c-(b-a), m,a,b,c);
25 // Check special case 0.
26 for (i = iterations; i > 0; i--) {
27 cl_I m = testrandom_I();
28 cl_modint_ring R = find_modint_ring(m);
29 cl_MI a = R->canonhom(testrandom_I());
31 ASSERT2(a-z == a, m,a);
32 ASSERT2(z-(z-a) == a, m,a);