diff options
author | Keith Rothman <537074+litghost@users.noreply.github.com> | 2021-02-24 08:56:55 -0800 |
---|---|---|
committer | Keith Rothman <537074+litghost@users.noreply.github.com> | 2021-02-24 08:56:55 -0800 |
commit | 9b7fc3ea52a20dd6a05d90b6f332fa001dd1c615 (patch) | |
tree | b8ecd0a3838c230a91492d5622c8de2003fc4c69 | |
parent | cf3fb0b3b76a852c72b77a97aa201d198e8b6601 (diff) | |
download | nextpnr-tests-9b7fc3ea52a20dd6a05d90b6f332fa001dd1c615.tar.gz nextpnr-tests-9b7fc3ea52a20dd6a05d90b6f332fa001dd1c615.tar.bz2 nextpnr-tests-9b7fc3ea52a20dd6a05d90b6f332fa001dd1c615.zip |
Add some tests around resizing and bits_per_value.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
-rw-r--r-- | fpga_interchange/dynamic_bitarray.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fpga_interchange/dynamic_bitarray.cc b/fpga_interchange/dynamic_bitarray.cc index c2e4d7a..6925769 100644 --- a/fpga_interchange/dynamic_bitarray.cc +++ b/fpga_interchange/dynamic_bitarray.cc @@ -20,6 +20,7 @@ #include "gtest/gtest.h" #include "dynamic_bitarray.h" +#include <climits> namespace nextpnr { @@ -32,9 +33,12 @@ TEST_F(DynamicBitarrayTest, oneshot) for (size_t i = 0; i < 100; ++i) { std::vector<uint8_t> simple_storage; nextpnr::DynamicBitarray<> bitarray; + ASSERT_EQ(bitarray.bits_per_value(), CHAR_BIT); simple_storage.resize(i); bitarray.resize(i); + ASSERT_LE(i, bitarray.size()); + ASSERT_LT(bitarray.size() - i, CHAR_BIT); for (size_t k = 0; k < 3; ++k) { for (size_t j = 0; j < i; ++j) { |