aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-14 17:39:25 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-14 17:39:25 +0200
commit959d43a0aeedcbc80c9bb2d4c99b4f5bd4e7b3d2 (patch)
tree1e9b9b75fd5995f45afb88752547e0b81db48c64 /test
parent15ee8bd8885c8b3d0b4650fe609c253780f04bdf (diff)
clean up message type architecture
Diffstat (limited to 'test')
-rw-r--r--test/pbdrv/msg.cpp13
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));