]> www.ginac.de Git - cln.git/blob - tests/test_MI_div.cc
033ab8392feffdaa460981fbb9f3f528d97d4374
[cln.git] / tests / test_MI_div.cc
1 #include "test_MI.h"
2
3 int test_MI_div (int iterations)
4 {
5         int error = 0;
6         int i;
7         // Check against multiplication.
8         for (i = iterations; i > 0; i--) {
9                 cl_I m = testrandom_I();
10                 cl_modint_ring R = find_modint_ring(m);
11                 cl_I ai = testrandom_I();
12                 if (gcd(m,ai)==1) {
13                         cl_MI a = R->canonhom(ai);
14                         cl_MI b = R->canonhom(testrandom_I());
15                         ASSERT3(a*R->div(b,a) == b, m,a,b);
16                 }
17         }
18         return error;
19 }