summaryrefslogtreecommitdiffstats
path: root/libdimension/tests
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/tests')
-rw-r--r--libdimension/tests/Makefile.am14
-rw-r--r--libdimension/tests/c99.c32
-rw-r--r--libdimension/tests/cxx.cpp8
-rw-r--r--libdimension/tests/polynomial.c2
-rw-r--r--libdimension/tests/prtree.c5
-rw-r--r--libdimension/tests/render.c4
-rw-r--r--libdimension/tests/tests.h4
-rw-r--r--libdimension/tests/unit-test.c4
8 files changed, 55 insertions, 18 deletions
diff --git a/libdimension/tests/Makefile.am b/libdimension/tests/Makefile.am
index f56bd8b..a2d78ba 100644
--- a/libdimension/tests/Makefile.am
+++ b/libdimension/tests/Makefile.am
@@ -33,6 +33,7 @@ check_PROGRAMS = warning.test \
png.test \
gl.test \
render.test \
+ c99.test \
cxx.test
TESTS = $(check_PROGRAMS)
XFAIL_TESTS = warning-as-error.test error.test
@@ -51,10 +52,6 @@ libdimension_tests_la_SOURCES = test_canvas.c \
tests.h
libdimension_tests_la_LIBADD = $(top_builddir)/libdimension/libdimension.la
-libdimension_unit_test_la_SOURCES = unit-test.c
-libdimension_unit_test_la_CFLAGS = $(CHECK_CFLAGS) $(AM_CFLAGS)
-libdimension_unit_test_la_LIBADD = $(CHECK_LIBS) libdimension-tests.la
-
if GLX
libdimension_tests_la_SOURCES += display.c
libdimension_tests_la_LIBADD += -lX11 -lGL
@@ -62,6 +59,10 @@ else
libdimension_tests_la_SOURCES += display-stubs.c
endif
+libdimension_unit_test_la_SOURCES = unit-test.c
+libdimension_unit_test_la_CFLAGS = $(CHECK_CFLAGS) $(AM_CFLAGS)
+libdimension_unit_test_la_LIBADD = $(CHECK_LIBS) $(top_builddir)/libdimension/libdimension.la
+
warning_test_SOURCES = warning.c
warning_test_LDADD = libdimension-tests.la
@@ -95,6 +96,11 @@ gl_test_LDADD = libdimension-tests.la
render_test_SOURCES = render.c
render_test_LDADD = libdimension-tests.la
+c99_test_SOURCES = c99.c
+c99_test_LDADD = libdimension-tests.la
+
+c99.o: CFLAGS += -std=c99 -Wpedantic
+
cxx_test_SOURCES = cxx.cpp
cxx_test_LDADD = libdimension-tests.la
diff --git a/libdimension/tests/c99.c b/libdimension/tests/c99.c
new file mode 100644
index 0000000..e1a04ef
--- /dev/null
+++ b/libdimension/tests/c99.c
@@ -0,0 +1,32 @@
+/*************************************************************************
+ * Copyright (C) 2014 Tavian Barnes <tavianator@tavianator.com> *
+ * *
+ * This file is part of The Dimension Test Suite. *
+ * *
+ * The Dimension Test Suite is free software; you can redistribute it *
+ * and/or modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation; either version 3 of the *
+ * License, or (at your option) any later version. *
+ * *
+ * The Dimension Test Suite is distributed in the hope that it will be *
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty *
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see <http://www.gnu.org/licenses/>. *
+ *************************************************************************/
+
+/**
+ * @file
+ * Check strict C99 compliance of headers.
+ */
+
+#include "dimension.h"
+#include <stddef.h>
+
+int
+main(void)
+{
+ return EXIT_SUCCESS;
+}
diff --git a/libdimension/tests/cxx.cpp b/libdimension/tests/cxx.cpp
index 104ee1b..679fa23 100644
--- a/libdimension/tests/cxx.cpp
+++ b/libdimension/tests/cxx.cpp
@@ -17,12 +17,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*************************************************************************/
+/**
+ * @file
+ * Ensure that dimension.h can be included in a C++ program and behave properly.
+ */
+
#include "tests.h"
#include <cstdlib>
-/*
- * Ensure that dimension.h can be included in a C++ program and behave properly.
- */
int
main(void)
{
diff --git a/libdimension/tests/polynomial.c b/libdimension/tests/polynomial.c
index dc172d4..cc1d08e 100644
--- a/libdimension/tests/polynomial.c
+++ b/libdimension/tests/polynomial.c
@@ -159,7 +159,7 @@ DMNSN_TEST(cubic, one_root)
DMNSN_TEST(cubic, two_roots)
{
- /* poly[] = (x - 1)*(x - 4)^2 **/
+ // poly[] = (x - 1)*(x - 4)^2
static const double poly[] = {
[3] = 1.0,
[2] = -9.0,
diff --git a/libdimension/tests/prtree.c b/libdimension/tests/prtree.c
index 3c2b7bf..acdd426 100644
--- a/libdimension/tests/prtree.c
+++ b/libdimension/tests/prtree.c
@@ -17,8 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*************************************************************************/
-/*
- * Basic tests of PR-trees
+/**
+ * @file
+ * Basic tests of PR-trees.
*/
#include "../platform.c"
diff --git a/libdimension/tests/render.c b/libdimension/tests/render.c
index 2588937..866df2d 100644
--- a/libdimension/tests/render.c
+++ b/libdimension/tests/render.c
@@ -285,9 +285,7 @@ dmnsn_test_scene_add_objects(dmnsn_pool *pool, dmnsn_scene *scene)
dmnsn_test_scene_add_ground(pool, scene);
}
-/*
- * Test scene
- */
+/// Test scene.
static dmnsn_scene *
dmnsn_new_test_scene(dmnsn_pool *pool)
{
diff --git a/libdimension/tests/tests.h b/libdimension/tests/tests.h
index 6e9ad21..afa7c11 100644
--- a/libdimension/tests/tests.h
+++ b/libdimension/tests/tests.h
@@ -107,9 +107,7 @@ void dmnsn_test_teardown(void);
static void \
fixture(void)
-/*
- * Test canvas
- */
+/// Test canvas.
void dmnsn_paint_test_canvas(dmnsn_canvas *canvas);
/*
diff --git a/libdimension/tests/unit-test.c b/libdimension/tests/unit-test.c
index 5d3f699..cc84387 100644
--- a/libdimension/tests/unit-test.c
+++ b/libdimension/tests/unit-test.c
@@ -60,8 +60,8 @@ __attribute__((destructor))
static void
dmnsn_test_cleanup(void)
{
- /* Can't go in dmnsn_test_teardown(), because it should run even if the test
- fails. */
+ // Can't go in dmnsn_test_teardown(), because it should run even if the test
+ // fails
dmnsn_delete_dictionary(dmnsn_test_cases);
}