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.

24 lines
613 B

25 years ago
  1. #include "test_I.h"
  2. int test_I_logior (int iterations)
  3. {
  4. int error = 0;
  5. int i;
  6. // Check commutativity.
  7. for (i = iterations; i > 0; i--) {
  8. cl_I a = testrandom_I();
  9. cl_I b = testrandom_I();
  10. ASSERT2(logior(a,b) == logior(b,a), a,b);
  11. }
  12. // Check against ash and oddp.
  13. for (i = iterations; i > 0; i--) {
  14. cl_I a = testrandom_I();
  15. cl_I b = testrandom_I();
  16. ASSERT2(oddp(logior(a,b)) == (oddp(a) | oddp(b)), a,b);
  17. sintL c = random32() % 1024;
  18. ASSERT3(logior(ash(a,c),ash(b,c)) == ash(logior(a,b),c), a,b,c);
  19. ASSERT3(logior(ash(a,-c),ash(b,-c)) == ash(logior(a,b),-c), a,b,c);
  20. }
  21. return error;
  22. }