You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
627 B

25 years ago
  1. #include "test_I.h"
  2. #include "cl_GV_integer.h"
  3. int test_I_GV (int iterations)
  4. {
  5. int error = 0;
  6. int i;
  7. for (i = iterations; i > 0; i--) {
  8. uintL m = random32() % 70;
  9. uintL len = random32() % 64;
  10. cl_GV_I v = cl_GV_I(len,m);
  11. cl_I M = random_I((cl_I)1 << m) + 1; // 0 < M <= 2^m
  12. cl_I a = random_I(M);
  13. int j;
  14. for (j = 0; j < len; j++)
  15. v[j] = mod(a*(j*j),M);
  16. for (j = len-1; j >= 0; j--)
  17. #if !(defined(__GNUC__) && (__GNUC_MINOR__ < 8))
  18. ASSERT4(v[j] == mod(a*(j*j),M), m,len,M,j);
  19. #else // work around g++ 2.7.2 bug
  20. ASSERT4(v[j] == mod(a*(j*j),M), (cl_I)m,(cl_I)len,M,(cl_I)j);
  21. #endif
  22. }
  23. return error;
  24. }