]> www.ginac.de Git - cln.git/blob - tests/test_I_GV.cc
2006-05-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
[cln.git] / tests / test_I_GV.cc
1 #include "test_I.h"
2 #include "cln/GV_integer.h"
3
4 int test_I_GV (int iterations)
5 {
6         int error = 0;
7         int i;
8         for (i = iterations; i > 0; i--) {
9                 uintL m = random32() % 70;
10                 uintL len = random32() % 64;
11                 cl_GV_I v = cl_GV_I(len,m);
12                 cl_I M = random_I((cl_I)1 << m) + 1; // 0 < M <= 2^m
13                 cl_I a = random_I(M);
14                 int j;
15                 for (j = 0; j < len; j++)
16                         v[j] = mod(a*(j*j),M);
17                 for (j = len-1; j >= 0; j--)
18                         ASSERT4(v[j] == mod(a*(j*j),M), m,len,M,j);
19         }
20         return error;
21 }