int main(void) { struct lgtd_client *client; client = lgtd_tests_insert_mock_client(FAKE_BUFFEREVENT); struct lgtd_proto_target_list *targets = (void *)0x2a; lgtd_proto_get_light_state(client, targets); const char expected[] = "[]"; if (client_write_buf_idx != sizeof(expected) - 1) { lgtd_errx( 1, "%d bytes written, expected %lu", client_write_buf_idx, sizeof(expected) - 1UL ); } if (memcmp(expected, client_write_buf, sizeof(expected) - 1)) { lgtd_errx( 1, "got %.*s instead of %s", client_write_buf_idx, client_write_buf, expected ); } return 0; }
int main(void) { struct lgtd_proto_target_list *targets; targets = lgtd_tests_build_target_list("*", NULL); struct lgtd_client *client; client = lgtd_tests_insert_mock_client(FAKE_BUFFEREVENT); lgtd_proto_power_off(client, targets); return 0; }
int main(void) { struct lgtd_proto_target_list *targets; targets = lgtd_tests_build_target_list("*", NULL); struct lgtd_client *client; client = lgtd_tests_insert_mock_client(FAKE_BUFFEREVENT); lgtd_proto_set_label(client, targets, "test"); if (!router_send_call_count) { errx(1, "lgtd_router_send wasn't called"); } if (!client_send_response_call_count) { errx(1, "lgtd_client_send_response wasn't called"); } return 0; }
int main(void) { struct lgtd_client *client; client = lgtd_tests_insert_mock_client(FAKE_BUFFEREVENT); lgtd_client_read_callback(FAKE_BUFFEREVENT, client); if (!evbuffer_get_contiguous_space_call_count) { errx(1, "evbuffer_get_contiguous_space not called"); } if (!jsonrpc_dispatch_request_call_count) { errx(1, "jsonrpc_dispatch_request not called"); } if (!evbuffer_drain_call_count) { errx(1, "evbuffer_drain not called"); } if (!evbuffer_pullup_call_count) { errx(1, "evbuffer_pullup not called"); } return 0; }