aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-09-29 18:39:05 +0200
committerDavid Robillard <d@drobilla.net>2018-09-29 18:39:05 +0200
commit1c826ec5da9f5c364fe1a32cf55200548a9985f0 (patch)
tree2c230c545b796fb8ea0db7eb7600ec8d5fc101c5 /test
parent0a5a45ff8ae437ddf1c3b8de425f30a44e6f5580 (diff)
downloadchilbert-1c826ec5da9f5c364fe1a32cf55200548a9985f0.tar.gz
chilbert-1c826ec5da9f5c364fe1a32cf55200548a9985f0.tar.bz2
chilbert-1c826ec5da9f5c364fe1a32cf55200548a9985f0.zip
Strengthen shift tests
Diffstat (limited to 'test')
-rw-r--r--test/test_bitvec.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/test_bitvec.cpp b/test/test_bitvec.cpp
index 581b74e..4928282 100644
--- a/test/test_bitvec.cpp
+++ b/test/test_bitvec.cpp
@@ -176,13 +176,13 @@ test_left_shift(Context& ctx)
T r = v;
assert((v << s) == (r <<= s));
- for (size_t i = s; i < N - s; ++i) {
- assert(r.test(i + s) == v.test(i));
- }
-
for (size_t i = 0; i < s; ++i) {
assert(!r.test(i));
}
+
+ for (size_t i = s; i < N; ++i) {
+ assert(r.test(i) == v.test(i - s));
+ }
}
}
@@ -195,13 +195,13 @@ test_right_shift(Context& ctx)
T r = v;
assert((v >> s) == (r >>= s));
- for (size_t i = s; i < N - s; ++i) {
- assert(r.test(i - s) == v.test(i));
- }
-
for (size_t i = N - 1; i > N - s - 1; --i) {
assert(!r.test(i));
}
+
+ for (size_t i = 0; i <= N - s - 1; ++i) {
+ assert(r.test(i) == v.test(i + s));
+ }
}
}