aboutsummaryrefslogtreecommitdiff
path: root/test/pbdrv/write.cpp
blob: ad775bb46986f8bd7245774cd39535250b9a0130 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include <gtest/gtest.h>

#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({
		.state = PB_GS_PLAYING,
	});

	ASSERT_NE(buf.data, nullptr);
	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);
}