PageRenderTime 64ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/cln-1.3.2/tests/test_I_lognot.cc

#
C++ | 18 lines | 15 code | 1 blank | 2 comment | 5 complexity | 49dcf88f202e2a9aed9e49f47c32d0b2 MD5 | raw file
Possible License(s): GPL-2.0
  1. #include "test_I.h"
  2. int test_I_lognot (int iterations)
  3. {
  4. int error = 0;
  5. int i;
  6. // Check involution, sign, and against "+".
  7. for (i = iterations; i > 0; i--) {
  8. cl_I a = testrandom_I();
  9. cl_I b = lognot(a);
  10. ASSERT1(lognot(b) == a, a);
  11. ASSERT1(minusp(a) != minusp(b), a);
  12. ASSERT1(a+b == -1, a);
  13. }
  14. // Check special cases 0 and -1.
  15. ASSERT(lognot(0) == -1);
  16. return error;
  17. }