aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-08-19 01:42:30 +0200
committerDavid Robillard <d@drobilla.net>2018-09-29 14:47:26 +0200
commit09f8d4a4b20f234dafcdf2ce667f220801b9210f (patch)
tree76e02b8e23d33c86e803193eeb2d4d906c8e4728 /test
parent967d2ac6c2034d1374fc603e64212fc06b5f6133 (diff)
downloadchilbert-09f8d4a4b20f234dafcdf2ce667f220801b9210f.tar.gz
chilbert-09f8d4a4b20f234dafcdf2ce667f220801b9210f.tar.bz2
chilbert-09f8d4a4b20f234dafcdf2ce667f220801b9210f.zip
Make size of bit vectors precise
Diffstat (limited to 'test')
-rw-r--r--test/test_bitvec.cpp24
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));
}
}
}