diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-11 11:16:38 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-11 11:16:38 +0200 |
commit | c99e160261c2a443f61de8e073497cce1542821e (patch) | |
tree | 22b7fc28d525853838de8933e33ccab351558662 /test/pbdrv | |
parent | 63fed0e85b72e27049ce14c80127859b387460dd (diff) |
pb-write + tests
Diffstat (limited to 'test/pbdrv')
-rw-r--r-- | test/pbdrv/write.cpp | 60 |
1 files changed, 59 insertions, 1 deletions
diff --git a/test/pbdrv/write.cpp b/test/pbdrv/write.cpp index 31e5d8d..ad775bb 100644 --- a/test/pbdrv/write.cpp +++ b/test/pbdrv/write.cpp @@ -2,9 +2,57 @@ #include "pb-write.h" +TEST(pbdrv, write_cmd_req_read) { + pbdrv_buf_t buf = pbdrv_write_cmd_req_read({ + .propid = 0, + }); + + ASSERT_NE(buf.data, nullptr); + ASSERT_GE(buf.size, 0); +} + +TEST(pbdrv, write_cmd_res_read) { + pbdrv_buf_t buf = pbdrv_write_cmd_res_read({ + .propid = 0, + .value = (uint8_t[]) { 0x00, }, + ._value_size = 1, + }); + + ASSERT_NE(buf.data, nullptr); + ASSERT_GE(buf.size, 0); +} + +TEST(pbdrv, write_cmd_req_write) { + pbdrv_buf_t buf = pbdrv_write_cmd_req_write({ + .propid = 0, + .value = (uint8_t[]) { 0x00, }, + ._value_size = 1, + }); + + ASSERT_NE(buf.data, nullptr); + ASSERT_GE(buf.size, 0); +} + +TEST(pbdrv, write_cmd_req_state) { + pbdrv_buf_t buf = pbdrv_write_cmd_req_state({ + .state = PB_GS_PLAYING, + }); + + ASSERT_NE(buf.data, nullptr); + ASSERT_GE(buf.size, 0); +} + +TEST(pbdrv, write_cmd_res_state) { + pbdrv_buf_t buf = pbdrv_write_cmd_res_state({ + .state = PB_GS_IDLE, + }); + + ASSERT_NE(buf.data, nullptr); + ASSERT_GE(buf.size, 0); +} + TEST(pbdrv, write_cmd_req_set_state) { pbdrv_buf_t buf = pbdrv_write_cmd_req_set_state({ - .header = { .sender = 0xf0, }, .state = PB_GS_PLAYING, }); @@ -12,3 +60,13 @@ TEST(pbdrv, write_cmd_req_set_state) { ASSERT_GE(buf.size, 0); } +TEST(pbdrv, write_cmd_magic) { + pbdrv_buf_t buf = pbdrv_write_cmd_magic({ + .magic = pb_cmd_magic_msg, + ._magic_size = sizeof(pb_cmd_magic_msg), + }); + + ASSERT_NE(buf.data, nullptr); + ASSERT_GE(buf.size, 0); +} + |