diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-20 12:20:46 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-20 13:11:29 +0100 |
commit | 925d566c188bfad3709e55ac223bee52ae2bc60c (patch) | |
tree | 6b382be23ce906e65d9903241e181cd6f57765d0 /tests/mtp | |
parent | 460a8eb8654ae945ac73b46f5f078ced611a4478 (diff) |
mtp: Fix the address mask, macro to extract opc/dpc
Fix the address mask, add macro to extract the DPC
and OPC from an address. Write a test case for this.
Diffstat (limited to 'tests/mtp')
-rw-r--r-- | tests/mtp/mtp_parse_test.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/mtp/mtp_parse_test.c b/tests/mtp/mtp_parse_test.c index 2ef726b..cd5d603 100644 --- a/tests/mtp/mtp_parse_test.c +++ b/tests/mtp/mtp_parse_test.c @@ -589,6 +589,18 @@ int main(int argc, char **argv) tests[2].hdr.addr = MTP_ADDR(0x00, 136, 91); tests[2].prohib.apoc = MTP_MAKE_APOC(86); + addr = MTP_ADDR(0x00, 0x2AAA, 0x1555); + if (MTP_ADDR_OPC(addr) != 0x1555) { + fprintf(stderr, "Failed to extract OPC: %d\n", + MTP_ADDR_OPC(addr)); + abort(); + } + if (MTP_ADDR_DPC(addr) != 0x2AAA) { + fprintf(stderr, "Failed to extract DPC: %d\n", + MTP_ADDR_DPC(addr)); + abort(); + } + for (i = 0; i < ARRAY_SIZE(tests); ++i) { check_hdr(tests[i].input, &tests[i].hdr); if (tests[i].has_mng) |