summaryrefslogtreecommitdiffstats
path: root/tests/protocol.c
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2021-07-08 11:18:08 +0300
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2021-07-28 13:19:02 +0300
commita2a3f6912e60c7932bad87a6d2249f0e83e637e1 (patch)
tree26a0ca7ac799c06ece9d657b634b3fea00ea6c6e /tests/protocol.c
parent6804d3b2a2a93fa5113c962878867b373c0358f7 (diff)
style: convert code to systemd coding style
https://systemd.io/CODING_STYLE/ Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
Diffstat (limited to 'tests/protocol.c')
-rw-r--r--tests/protocol.c112
1 files changed, 58 insertions, 54 deletions
diff --git a/tests/protocol.c b/tests/protocol.c
index 334c511..1d29db3 100644
--- a/tests/protocol.c
+++ b/tests/protocol.c
@@ -11,65 +11,69 @@
#include <spa/pod/parser.h>
#include <icipc.h>
-static void
-test_icipc_protocol ()
-{
- uint8_t b[1024];
+static void test_icipc_protocol() {
+ uint8_t b[1024];
- /* request null value */
- {
- icipc_protocol_build_request (b, sizeof(b), "name", NULL);
- const char *name = NULL;
- const struct spa_pod *value = NULL;
- test_bool_true (icipc_protocol_parse_request (b, sizeof(b), &name, &value));
- test_str_eq (name, "name");
- test_bool_true (spa_pod_is_none (value));
- }
+ /* request null value */
+ {
+ icipc_protocol_build_request(b, sizeof(b), "name", NULL);
+ const char *name = NULL;
+ const struct spa_pod *value = NULL;
+ test_bool_true(icipc_protocol_parse_request
+ (b, sizeof(b), &name, &value));
+ test_str_eq(name, "name");
+ test_bool_true(spa_pod_is_none(value));
+ }
- /* request */
- {
- struct spa_pod_int i = SPA_POD_INIT_Int (8);
- icipc_protocol_build_request (b, sizeof(b), "name", (struct spa_pod *)&i);
- const char *name = NULL;
- const struct spa_pod_int *value = NULL;
- test_bool_true (icipc_protocol_parse_request (b, sizeof(b), &name, (const struct spa_pod **)&value));
- test_str_eq (name, "name");
- test_cmpint (value->value, ==, 8);
- }
+ /* request */
+ {
+ struct spa_pod_int i = SPA_POD_INIT_Int(8);
+ icipc_protocol_build_request(b, sizeof(b), "name",
+ (struct spa_pod *)&i);
+ const char *name = NULL;
+ const struct spa_pod_int *value = NULL;
+ test_bool_true(icipc_protocol_parse_request
+ (b, sizeof(b), &name,
+ (const struct spa_pod **)&value));
+ test_str_eq(name, "name");
+ test_cmpint(value->value, ==, 8);
+ }
- /* reply error */
- {
- icipc_protocol_build_reply_error (b, sizeof(b), "error message");
- test_bool_true (icipc_protocol_is_reply_error (b, sizeof(b)));
- const char *msg = NULL;
- test_bool_true (icipc_protocol_parse_reply_error (b, sizeof(b), &msg));
- test_str_eq (msg, "error message");
- }
+ /* reply error */
+ {
+ icipc_protocol_build_reply_error(b, sizeof(b), "error message");
+ test_bool_true(icipc_protocol_is_reply_error(b, sizeof(b)));
+ const char *msg = NULL;
+ test_bool_true(icipc_protocol_parse_reply_error
+ (b, sizeof(b), &msg));
+ test_str_eq(msg, "error message");
+ }
- /* reply ok null value */
- {
- icipc_protocol_build_reply_ok (b, sizeof(b), NULL);
- test_bool_true (icipc_protocol_is_reply_ok (b, sizeof(b)));
- const struct spa_pod *value = NULL;
- test_bool_true (icipc_protocol_parse_reply_ok (b, sizeof(b), &value));
- test_ptr_notnull (value);
- test_bool_true (spa_pod_is_none (value));
- }
+ /* reply ok null value */
+ {
+ icipc_protocol_build_reply_ok(b, sizeof(b), NULL);
+ test_bool_true(icipc_protocol_is_reply_ok(b, sizeof(b)));
+ const struct spa_pod *value = NULL;
+ test_bool_true(icipc_protocol_parse_reply_ok
+ (b, sizeof(b), &value));
+ test_ptr_notnull(value);
+ test_bool_true(spa_pod_is_none(value));
+ }
- /* reply ok */
- {
- struct spa_pod_int i = SPA_POD_INIT_Int (3);
- icipc_protocol_build_reply_ok (b, sizeof(b), (struct spa_pod *)&i);
- test_bool_true (icipc_protocol_is_reply_ok (b, sizeof(b)));
- const struct spa_pod_int *value = NULL;
- test_bool_true (icipc_protocol_parse_reply_ok (b, sizeof(b), (const struct spa_pod **)&value));
- test_cmpint (value->value, ==, 3);
- }
+ /* reply ok */
+ {
+ struct spa_pod_int i = SPA_POD_INIT_Int(3);
+ icipc_protocol_build_reply_ok(b, sizeof(b),
+ (struct spa_pod *)&i);
+ test_bool_true(icipc_protocol_is_reply_ok(b, sizeof(b)));
+ const struct spa_pod_int *value = NULL;
+ test_bool_true(icipc_protocol_parse_reply_ok
+ (b, sizeof(b), (const struct spa_pod **)&value));
+ test_cmpint(value->value, ==, 3);
+ }
}
-int
-main (int argc, char *argv[])
-{
- test_icipc_protocol();
- return TEST_PASS;
+int main(int argc, char *argv[]) {
+ test_icipc_protocol();
+ return TEST_PASS;
}