aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-08-18 11:07:42 +0200
committerDavid Robillard <d@drobilla.net>2018-09-29 14:46:32 +0200
commitc5da9a74522967446d796dce5cf9d30ff7b8cec3 (patch)
tree0f0d06ecc29c7fb9309b61ca2526d7ccefdd536f /test
parentfc24951cba40ab471f64f9f2825b4abe541e1283 (diff)
downloadchilbert-c5da9a74522967446d796dce5cf9d30ff7b8cec3.tar.gz
chilbert-c5da9a74522967446d796dce5cf9d30ff7b8cec3.tar.bz2
chilbert-c5da9a74522967446d796dce5cf9d30ff7b8cec3.zip
Add comparison operators
Diffstat (limited to 'test')
-rw-r--r--test/test_bitvec.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test_bitvec.cpp b/test/test_bitvec.cpp
index 61685d1..8305675 100644
--- a/test/test_bitvec.cpp
+++ b/test/test_bitvec.cpp
@@ -248,6 +248,25 @@ test_gray_code()
template <class T, size_t N>
void
+test_comparison()
+{
+ T a = make_zero_bitvec<T, N>();
+ T b = make_zero_bitvec<T, N>();
+
+ for (size_t bit = 1; bit < N; ++bit) {
+ setBit(a, bit, 1);
+
+ for (size_t i = 0; i < bit; ++i) {
+ setBit(a, i, rand() % 2 == 0);
+ setBit(b, i, rand() % 2 == 0);
+ }
+
+ assert(b < a);
+ }
+}
+
+template <class T, size_t N>
+void
test()
{
test_and<T, N>();
@@ -264,6 +283,7 @@ test()
test_right_shift<T, N>();
test_find_first<T, N>();
test_gray_code<T, N>();
+ test_comparison<T, N>();
}
int