summaryrefslogtreecommitdiffstats
path: root/test/json.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/json.c')
-rw-r--r--test/json.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/test/json.c b/test/json.c
index e95f88c972..8aeae2326e 100644
--- a/test/json.c
+++ b/test/json.c
@@ -1,7 +1,6 @@
-#include "common/common.h"
#include "misc/json.h"
#include "misc/node.h"
-#include "tests.h"
+#include "test_utils.h"
struct entry {
const char *src;
@@ -64,9 +63,7 @@ static const struct entry entries[] = {
NODE_MAP(L("_a12"), L(NODE_STR("b")))},
};
-#define MAX_DEPTH 10
-
-static void run(struct test_ctx *ctx)
+int main(void)
{
for (int n = 0; n < MP_ARRAY_SIZE(entries); n++) {
const struct entry *e = &entries[n];
@@ -74,7 +71,7 @@ static void run(struct test_ctx *ctx)
char *s = talloc_strdup(tmp, e->src);
json_skip_whitespace(&s);
struct mpv_node res;
- bool ok = json_parse(tmp, &res, &s, MAX_DEPTH) >= 0;
+ bool ok = json_parse(tmp, &res, &s, MAX_JSON_DEPTH) >= 0;
assert_true(ok != e->expect_fail);
if (!ok) {
talloc_free(tmp);
@@ -86,9 +83,5 @@ static void run(struct test_ctx *ctx)
assert_true(equal_mpv_node(&e->out_data, &res));
talloc_free(tmp);
}
+ return 0;
}
-
-const struct unittest test_json = {
- .name = "json",
- .run = run,
-};