diff options
Diffstat (limited to 'tests/bits')
-rw-r--r-- | tests/bits/bitrev_test.c | 5 | ||||
-rw-r--r-- | tests/bits/bitrev_test.ok | 48 |
2 files changed, 28 insertions, 25 deletions
diff --git a/tests/bits/bitrev_test.c b/tests/bits/bitrev_test.c index b96241c5..ed3939a3 100644 --- a/tests/bits/bitrev_test.c +++ b/tests/bits/bitrev_test.c @@ -208,6 +208,9 @@ check16(uint16_t test, enum END e) static void sh_chk(const uint8_t *in, uint8_t len, unsigned int nib, bool r) { uint8_t x[len]; + int bytes = nib/2 + (nib & 1); + OSMO_ASSERT(len >= bytes); + memset(x, 0xcc, len); if (r) osmo_nibble_shift_right(x, in, nib); else @@ -217,7 +220,7 @@ static void sh_chk(const uint8_t *in, uint8_t len, unsigned int nib, bool r) osmo_hexdump_nospc(in, len), nib); /* do NOT combine those printfs: osmo_hexdump* use static buffer which WILL screw things up in that case */ - printf("\n OUT: %s\n", osmo_hexdump_nospc(x, nib/2)); + printf("\n OUT: %s\n", osmo_hexdump_nospc(x, bytes)); } int main(int argc, char **argv) diff --git a/tests/bits/bitrev_test.ok b/tests/bits/bitrev_test.ok index e6f52af6..d2fb12ce 100644 --- a/tests/bits/bitrev_test.ok +++ b/tests/bits/bitrev_test.ok @@ -63,13 +63,13 @@ running nibble tests... [6] L IN: b00bbabeface, nibble 0: OUT: [8] R IN: f00dcafedeadbeef, nibble 1: - OUT: + OUT: cc [8] L IN: f00dcafedeadbeef, nibble 1: - OUT: + OUT: cc [6] R IN: b00bbabeface, nibble 1: - OUT: + OUT: cc [6] L IN: b00bbabeface, nibble 1: - OUT: + OUT: cc [8] R IN: f00dcafedeadbeef, nibble 2: OUT: 0f [8] L IN: f00dcafedeadbeef, nibble 2: @@ -79,13 +79,13 @@ running nibble tests... [6] L IN: b00bbabeface, nibble 2: OUT: 00 [8] R IN: f00dcafedeadbeef, nibble 3: - OUT: 0f + OUT: 0f00 [8] L IN: f00dcafedeadbeef, nibble 3: - OUT: 00 + OUT: 00d0 [6] R IN: b00bbabeface, nibble 3: - OUT: 0b + OUT: 0b00 [6] L IN: b00bbabeface, nibble 3: - OUT: 00 + OUT: 00b0 [8] R IN: f00dcafedeadbeef, nibble 4: OUT: 0f00 [8] L IN: f00dcafedeadbeef, nibble 4: @@ -95,13 +95,13 @@ running nibble tests... [6] L IN: b00bbabeface, nibble 4: OUT: 00bb [8] R IN: f00dcafedeadbeef, nibble 5: - OUT: 0f00 + OUT: 0f00dc [8] L IN: f00dcafedeadbeef, nibble 5: - OUT: 00dc + OUT: 00dca0 [6] R IN: b00bbabeface, nibble 5: - OUT: 0b00 + OUT: 0b00bb [6] L IN: b00bbabeface, nibble 5: - OUT: 00bb + OUT: 00bba0 [8] R IN: f00dcafedeadbeef, nibble 6: OUT: 0f00dc [8] L IN: f00dcafedeadbeef, nibble 6: @@ -111,13 +111,13 @@ running nibble tests... [6] L IN: b00bbabeface, nibble 6: OUT: 00bbab [8] R IN: f00dcafedeadbeef, nibble 7: - OUT: 0f00dc + OUT: 0f00dcaf [8] L IN: f00dcafedeadbeef, nibble 7: - OUT: 00dcaf + OUT: 00dcafe0 [6] R IN: b00bbabeface, nibble 7: - OUT: 0b00bb + OUT: 0b00bbab [6] L IN: b00bbabeface, nibble 7: - OUT: 00bbab + OUT: 00bbabe0 [8] R IN: f00dcafedeadbeef, nibble 8: OUT: 0f00dcaf [8] L IN: f00dcafedeadbeef, nibble 8: @@ -127,13 +127,13 @@ running nibble tests... [6] L IN: b00bbabeface, nibble 8: OUT: 00bbabef [8] R IN: f00dcafedeadbeef, nibble 9: - OUT: 0f00dcaf + OUT: 0f00dcafed [8] L IN: f00dcafedeadbeef, nibble 9: - OUT: 00dcafed + OUT: 00dcafede0 [6] R IN: b00bbabeface, nibble 9: - OUT: 0b00bbab + OUT: 0b00bbabef [6] L IN: b00bbabeface, nibble 9: - OUT: 00bbabef + OUT: 00bbabefa0 [8] R IN: f00dcafedeadbeef, nibble 10: OUT: 0f00dcafed [8] L IN: f00dcafedeadbeef, nibble 10: @@ -143,13 +143,13 @@ running nibble tests... [6] L IN: b00bbabeface, nibble 10: OUT: 00bbabefac [8] R IN: f00dcafedeadbeef, nibble 11: - OUT: 0f00dcafed + OUT: 0f00dcafedea [8] L IN: f00dcafedeadbeef, nibble 11: - OUT: 00dcafedea + OUT: 00dcafedead0 [6] R IN: b00bbabeface, nibble 11: - OUT: 0b00bbabef + OUT: 0b00bbabefac [6] L IN: b00bbabeface, nibble 11: - OUT: 00bbabefac + OUT: 00bbabeface0 [8] R IN: f00dcafedeadbeef, nibble 12: OUT: 0f00dcafedea [8] L IN: f00dcafedeadbeef, nibble 12: |