/cln-1.3.2/tests/test_I_GV.cc
C++ | 21 lines | 20 code | 1 blank | 0 comment | 4 complexity | 8a5048aee224d026ae89a1c072a481ae MD5 | raw file
Possible License(s): GPL-2.0
1#include "test_I.h"
2#include "cln/GV_integer.h"
3
4int 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}