aboutsummaryrefslogtreecommitdiff
path: root/test/pbdrv/msg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/pbdrv/msg.cpp')
-rw-r--r--test/pbdrv/msg.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/test/pbdrv/msg.cpp b/test/pbdrv/msg.cpp
index afc548e..d58d6f3 100644
--- a/test/pbdrv/msg.cpp
+++ b/test/pbdrv/msg.cpp
@@ -1,16 +1,18 @@
#include <gtest/gtest.h>
#include "pb-msg.h"
+#include "pb-send.h"
+#include "pb-mod.h"
TEST(pb_msg_rw, cmd_req_read) {
- pb_cmd_prop_t content = {
+ pb_cmd_prop_t cmd = {
.propid = 2,
};
pb_msg_t msg_write = {
.type = PB_CMD_PROP,
.action = PB_ACTION_REQ,
.sender = 0xff,
- .msg = &content,
+ .cmd = &cmd,
};
pb_buf_t buf = pb_msg_write(&msg_write);
@@ -24,15 +26,15 @@ TEST(pb_msg_rw, cmd_req_read) {
EXPECT_EQ(msg_write.type, msg_read->type);
EXPECT_EQ(msg_write.sender, msg_read->sender);
- EXPECT_NE(nullptr, msg_read->msg);
- pb_cmd_prop_t * prop = (pb_cmd_prop_t *) msg_read->msg;
- EXPECT_EQ(prop->propid, content.propid);
+ EXPECT_NE(nullptr, msg_read->cmd);
+ pb_cmd_prop_t * prop = (pb_cmd_prop_t *) msg_read->cmd;
+ EXPECT_EQ(prop->propid, cmd.propid);
pb_msg_free(msg_read);
}
TEST(pb_msg_rw, cmd_req_magic) {
- pb_buf_t buf = pb_msg_write_req_magic();
+ pb_buf_t buf = pb_send_req_magic();
ASSERT_NE(buf.data, nullptr);
ASSERT_GE(buf.size, 0);
@@ -43,9 +45,9 @@ TEST(pb_msg_rw, cmd_req_magic) {
ASSERT_EQ(buf.data, nullptr);
EXPECT_EQ(msg_read->type, PB_CMD_MAGIC);
- EXPECT_EQ(msg_read->sender, 0);
- EXPECT_NE(msg_read->msg, nullptr);
- pb_cmd_magic_t * magic = (pb_cmd_magic_t *) msg_read->msg;
+ EXPECT_EQ(msg_read->sender, PB_MOD_ADDR);
+ EXPECT_NE(msg_read->cmd, nullptr);
+ pb_cmd_magic_t * magic = (pb_cmd_magic_t *) msg_read->cmd;
EXPECT_EQ(magic->_magic_size, sizeof(pb_cmd_magic_req));
EXPECT_EQ(0, memcmp(pb_cmd_magic_req, magic->magic, magic->_magic_size));