32static void test_status(
void) {
37 {
"status=OK\nversion=1.2.3\n",
38 {NULL, NULL, NULL, NULL, NULL,
true, 1, 2, 3,
"", 0, 0}},
39 {
"", {NULL, NULL, NULL, NULL, NULL,
false, 0, 0, 0,
"", 0, 0}},
40 {
"foobar", {NULL, NULL, NULL, NULL, NULL,
false, 0, 0, 0,
"", 0, 0}},
41 {
"\n\n\n\n\n\n", {NULL, NULL, NULL, NULL, NULL,
false, 0, 0, 0,
"", 0, 0}},
42 {
"status=NO_DEVICE\nserial=*\nversion=1.0.2\npid=412\naddress=\nport=12345",
43 {NULL, NULL, NULL, NULL, NULL,
false, 1, 0, 2,
"", 12345, 412}},
44 {
"version=1.2", {NULL, NULL, NULL, NULL, NULL,
false, 1, 2, 0,
"", 0, 0}},
46 {NULL, NULL, NULL, NULL, NULL,
false, 0, 0, 0,
"", 0, 0}},
47 {
"version=2..\nstatus=OK",
48 {NULL, NULL, NULL, NULL, NULL,
true, 2, 0, 0,
"", 0, 0}},
51 for (
size_t i = 0; i <
sizeof(tests) /
sizeof(tests[0]); i++) {
52 yh_connector c = {NULL, NULL, NULL, NULL, NULL,
false, 0, 0, 0,
"", 0, 0};
53 char *data = strdup(tests[i].data);
57 assert(memcmp(&c, &tests[i].c,
sizeof(c)) == 0);
void YH_INTERNAL parse_status_data(char *data, yh_connector *connector)