diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/pbdrv/msg.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/test/pbdrv/msg.cpp b/test/pbdrv/msg.cpp index 38df8f4..afc548e 100644 --- a/test/pbdrv/msg.cpp +++ b/test/pbdrv/msg.cpp @@ -3,11 +3,12 @@ #include "pb-msg.h" TEST(pb_msg_rw, cmd_req_read) { - pb_cmd_req_read_t content = { + pb_cmd_prop_t content = { .propid = 2, }; pb_msg_t msg_write = { - .type = PB_CMD_REQ_READ, + .type = PB_CMD_PROP, + .action = PB_ACTION_REQ, .sender = 0xff, .msg = &content, }; @@ -23,7 +24,9 @@ TEST(pb_msg_rw, cmd_req_read) { EXPECT_EQ(msg_write.type, msg_read->type); EXPECT_EQ(msg_write.sender, msg_read->sender); - EXPECT_EQ(((pb_cmd_req_read_t *) msg_write.msg)->propid, ((pb_cmd_req_read_t *) msg_read->msg)->propid); + EXPECT_NE(nullptr, msg_read->msg); + pb_cmd_prop_t * prop = (pb_cmd_prop_t *) msg_read->msg; + EXPECT_EQ(prop->propid, content.propid); pb_msg_free(msg_read); } @@ -39,10 +42,10 @@ TEST(pb_msg_rw, cmd_req_magic) { ASSERT_EQ(buf.data, nullptr); - EXPECT_EQ(msg_read->type, PB_CMD_REQ_MAGIC); + EXPECT_EQ(msg_read->type, PB_CMD_MAGIC); EXPECT_EQ(msg_read->sender, 0); EXPECT_NE(msg_read->msg, nullptr); - pb_cmd_res_magic_t * magic = (pb_cmd_res_magic_t *) msg_read->msg; + pb_cmd_magic_t * magic = (pb_cmd_magic_t *) msg_read->msg; EXPECT_EQ(magic->_magic_size, sizeof(pb_cmd_magic_req)); EXPECT_EQ(0, memcmp(pb_cmd_magic_req, magic->magic, magic->_magic_size)); |