aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/bitcomp/BitcompTest.cpp17
-rw-r--r--tests/bitcomp/BitcompTest.err4
2 files changed, 5 insertions, 16 deletions
diff --git a/tests/bitcomp/BitcompTest.cpp b/tests/bitcomp/BitcompTest.cpp
index f35d6be..c5fde2e 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
diff --git a/tests/bitcomp/BitcompTest.err b/tests/bitcomp/BitcompTest.err
index f769daa..1d6fb00 100644
--- a/tests/bitcomp/BitcompTest.err
+++ b/tests/bitcomp/BitcompTest.err
@@ -11,7 +11,7 @@ Run_length = 31
Run_length = 19
Run_length = 32
-expected data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff db
+expected data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff c0
expected len = 194
decoded data = ff ff ff f8 00 00 01 ff ff ff f8 00 00 00 ff ff ff fe 00 00 3f ff ff ff c0
decoded len = 194
@@ -25,7 +25,7 @@ Run_length = 40
Run_length = 51
Run_length = 41
-expected data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 03
+expected data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 00
expected len = 182
decoded data = ff ff ff ff ff ff c0 00 00 00 00 3f ff ff ff ff ff f8 00 00 00 00 00
decoded len = 182