summaryrefslogtreecommitdiff
path: root/test/tests.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2015-07-19 15:23:36 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2015-08-03 22:30:20 +0100
commit0b624c7fba92d74858746328888548d28b55f84a (patch)
treedef21828c16e8ce57d96c9cf07757c552f50a1de /test/tests.c
parent5496ba69d866145d2855e06c83c6441640e16231 (diff)
downloadlibnslayout-0b624c7fba92d74858746328888548d28b55f84a.tar.gz
libnslayout-0b624c7fba92d74858746328888548d28b55f84a.tar.bz2
Add basic tests for creating a layout object.
Diffstat (limited to 'test/tests.c')
-rw-r--r--test/tests.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/tests.c b/test/tests.c
new file mode 100644
index 0000000..a58e038
--- /dev/null
+++ b/test/tests.c
@@ -0,0 +1,52 @@
+/*
+ * This file is part of LibNSLayout's tests
+ * Licensed under the ISC License, http://opensource.org/licenses/ISC
+ * Copyright 2015 Michael Drake <tlsa@netsurf-browser.org>
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+
+#include <check.h>
+
+#include "tests.h"
+
+#ifndef UNUSED
+#define UNUSED(x) ((x) = (x))
+#endif
+
+#ifndef NDEBUG
+/* This means that assertion failures are silent in tests */
+void __assert_fail(const char *__assertion, const char *__file,
+ unsigned int __line, const char *__function) {
+ (void)__assertion;
+ (void)__file;
+ (void)__line;
+ (void)__function;
+ abort();
+}
+#endif
+
+int main(int argc, char **argv)
+{
+ int number_failed = 0;
+ SRunner *sr;
+
+ UNUSED(argc);
+ UNUSED(argv);
+
+ sr = srunner_create(suite_create("Test suite for libnslayout"));
+
+#ifndef NDEBUG
+ nslayout_assert_suite(sr);
+#endif
+ nslayout_basic_layout_suite(sr);
+
+ srunner_set_fork_status(sr, CK_FORK);
+ srunner_run_all(sr, CK_ENV);
+ number_failed = srunner_ntests_failed(sr);
+
+ srunner_free(sr);
+
+ return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}