summaryrefslogtreecommitdiffstats
path: root/test/json.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-02-25 21:50:08 -0600
committerDudemanguy <random342@airmail.cc>2023-03-02 15:45:27 +0000
commit9db818279aa63d071f2bca369235285314444dcd (patch)
tree9aafc5cf73e19ae8ea69751c060cab9766a6b9a4 /test/json.c
parent61532421571f972f076b3700d7ae468c0a0438c0 (diff)
downloadmpv-9db818279aa63d071f2bca369235285314444dcd.tar.bz2
mpv-9db818279aa63d071f2bca369235285314444dcd.tar.xz
test: integrate unittests with meson
This reworks all of mpv's unit tests so they are compiled as separate executables (optional) and run via meson test. Because most of the tests are dependant on mpv's internals, existing compiled objects are leveraged to create static libs and used when necessary. As an aside, a function was moved into video/out/gpu/utils for sanity's sake (otherwise most of vo would have been needed). As a plus, meson multithreads running tests automatically and also the output no longer pollutes the source directory. There are tests that can break due to ffmpeg changes, so they require a specific minimum libavutil version to be built.
Diffstat (limited to 'test/json.c')
-rw-r--r--test/json.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/test/json.c b/test/json.c
index e95f88c972..fb6633accf 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;
@@ -66,7 +65,7 @@ static const struct entry entries[] = {
#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];
@@ -86,9 +85,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,
-};