]> www.ginac.de Git - cln.git/blob - tests/test_I_minus.cc
Fix crashes in find_univpoly_ring and related functions
[cln.git] / tests / test_I_minus.cc
1 #include "test_I.h"
2
3 int test_I_minus (int iterations)
4 {
5         int error = 0;
6         int i;
7         // Check anti-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) == 0, a,b);
12         }
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) == c-(b-a), a,b,c);
19         }
20         // Check special case 0.
21         for (i = iterations; i > 0; i--) {
22                 cl_I a = testrandom_I();
23                 ASSERT1(a-0 == a, a);
24                 ASSERT1(0-(0-a) == a, a);
25         }
26         return error;
27 }