summaryrefslogtreecommitdiffstats
path: root/tests/protocol.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/protocol.c')
-rw-r--r--tests/protocol.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/tests/protocol.c b/tests/protocol.c
index 66f645e..334c511 100644
--- a/tests/protocol.c
+++ b/tests/protocol.c
@@ -6,7 +6,7 @@
* SPDX-License-Identifier: MIT
*/
-#include <glib.h>
+#include "test.h"
#include <spa/pod/builder.h>
#include <spa/pod/parser.h>
#include <icipc.h>
@@ -21,9 +21,9 @@ test_icipc_protocol ()
icipc_protocol_build_request (b, sizeof(b), "name", NULL);
const char *name = NULL;
const struct spa_pod *value = NULL;
- g_assert_true (icipc_protocol_parse_request (b, sizeof(b), &name, &value));
- g_assert_cmpstr (name, ==, "name");
- g_assert_true (spa_pod_is_none (value));
+ 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 */
@@ -32,47 +32,44 @@ test_icipc_protocol ()
icipc_protocol_build_request (b, sizeof(b), "name", (struct spa_pod *)&i);
const char *name = NULL;
const struct spa_pod_int *value = NULL;
- g_assert_true (icipc_protocol_parse_request (b, sizeof(b), &name, (const struct spa_pod **)&value));
- g_assert_cmpstr (name, ==, "name");
- g_assert_cmpint (value->value, ==, 8);
+ 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");
- g_assert_true (icipc_protocol_is_reply_error (b, sizeof(b)));
+ test_bool_true (icipc_protocol_is_reply_error (b, sizeof(b)));
const char *msg = NULL;
- g_assert_true (icipc_protocol_parse_reply_error (b, sizeof(b), &msg));
- g_assert_cmpstr (msg, ==, "error message");
+ 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);
- g_assert_true (icipc_protocol_is_reply_ok (b, sizeof(b)));
+ test_bool_true (icipc_protocol_is_reply_ok (b, sizeof(b)));
const struct spa_pod *value = NULL;
- g_assert_true (icipc_protocol_parse_reply_ok (b, sizeof(b), &value));
- g_assert_nonnull (value);
- g_assert_true (spa_pod_is_none (value));
+ 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);
- g_assert_true (icipc_protocol_is_reply_ok (b, sizeof(b)));
+ test_bool_true (icipc_protocol_is_reply_ok (b, sizeof(b)));
const struct spa_pod_int *value = NULL;
- g_assert_true (icipc_protocol_parse_reply_ok (b, sizeof(b), (const struct spa_pod **)&value));
- g_assert_cmpint (value->value, ==, 3);
+ test_bool_true (icipc_protocol_parse_reply_ok (b, sizeof(b), (const struct spa_pod **)&value));
+ test_cmpint (value->value, ==, 3);
}
}
-gint
-main (gint argc, gchar *argv[])
+int
+main (int argc, char *argv[])
{
- g_test_init (&argc, &argv, NULL);
-
- g_test_add_func ("/icipc/icipc-protocol", test_icipc_protocol);
-
- return g_test_run ();
+ test_icipc_protocol();
+ return TEST_PASS;
}