diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_bitvec.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/test/test_bitvec.cpp b/test/test_bitvec.cpp index 2fa62ca..178b39a 100644 --- a/test/test_bitvec.cpp +++ b/test/test_bitvec.cpp @@ -200,13 +200,13 @@ void test_left_rotate(Context& ctx) { const T v = make_random_bitvec<T, N>(ctx); - for (size_t width = 0; width < std::min(N, size_t(128)); ++width) { - for (size_t bits = 0; bits <= width; ++bits) { - T r = v; - r.rotl(bits, width); + for (size_t bits = 0; bits <= N; ++bits) { + T r = v; + r.rotl(bits); - for (size_t i = 0; i < width; ++i) { - assert(r.test((i + bits) % width) == v.test(i)); + if (N > 0) { + for (size_t i = 0; i < N; ++i) { + assert(r.test((i + bits) % N) == v.test(i)); } } } @@ -217,13 +217,13 @@ void test_right_rotate(Context& ctx) { const T v = make_random_bitvec<T, N>(ctx); - for (size_t width = 0; width < std::min(N, size_t(128)); ++width) { - for (size_t bits = 0; bits <= width; ++bits) { - T r = v; - r.rotr(bits, width); + for (size_t bits = 0; bits <= N; ++bits) { + T r = v; + r.rotr(bits); - for (size_t i = 0; i < width; ++i) { - assert(r.test(i) == v.test((i + bits) % width)); + if (N > 0) { + for (size_t i = 0; i < N; ++i) { + assert(r.test(i) == v.test((i + bits) % N)); } } } |