aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bitcomp/BitcompTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bitcomp/BitcompTest.cpp')
-rw-r--r--tests/bitcomp/BitcompTest.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/tests/bitcomp/BitcompTest.cpp b/tests/bitcomp/BitcompTest.cpp
index f35d6bec..c5fde2ea 100644
--- a/tests/bitcomp/BitcompTest.cpp
+++ b/tests/bitcomp/BitcompTest.cpp
@@ -38,7 +38,7 @@ struct test_data {
.ucmp_data = {
0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x01, 0xff, 0xff,
0xff, 0xf8, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfe,
- 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xdb
+ 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xc0
},
.ucmp_len = 194, .verify = 1
},
@@ -49,7 +49,7 @@ struct test_data {
.ucmp_data = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x00,
0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8,
- 0x00, 0x00, 0x00, 0x00, 0x03
+ 0x00, 0x00, 0x00, 0x00, 0x00
},
.ucmp_len = 182, .verify = 1
},
@@ -127,18 +127,7 @@ bool result_matches(const bitvec &bits, const uint8_t *exp_data, unsigned int ex
{
if (bits.cur_bit != exp_len)
return false;
- size_t n = (exp_len / 8);
- int rem = (exp_len % 8);
-
- if (memcmp(exp_data, bits.data, n) == 0) {
- if (rem == 0)
- return true;
- if ((bits.data[n] & MASK(rem)) == ((*(exp_data + n)) & MASK(rem)))
- return true;
- else
- return false;
- } else
- return false;
+ return (memcmp(exp_data, bits.data, CEIL_DIV_8(exp_len)) == 0);
}
/* To test decoding of compressed bitmap by Tree based method