diff options
Diffstat (limited to 'tests/libdimension')
-rw-r--r-- | tests/libdimension/Makefile.am | 16 | ||||
-rw-r--r-- | tests/libdimension/cxx.cpp | 3 | ||||
-rw-r--r-- | tests/libdimension/error.c | 6 | ||||
-rw-r--r-- | tests/libdimension/gl.c | 6 | ||||
-rw-r--r-- | tests/libdimension/list.c | 4 | ||||
-rw-r--r-- | tests/libdimension/png.c | 6 | ||||
-rw-r--r-- | tests/libdimension/polynomial.c | 4 | ||||
-rw-r--r-- | tests/libdimension/prtree.c | 4 | ||||
-rw-r--r-- | tests/libdimension/render.c | 4 | ||||
-rw-r--r-- | tests/libdimension/warning-as-error.c | 31 | ||||
-rw-r--r-- | tests/libdimension/warning.c | 31 |
11 files changed, 62 insertions, 53 deletions
diff --git a/tests/libdimension/Makefile.am b/tests/libdimension/Makefile.am index 718056e..8a53bcf 100644 --- a/tests/libdimension/Makefile.am +++ b/tests/libdimension/Makefile.am @@ -20,8 +20,9 @@ INCLUDES = -I$(top_srcdir)/libdimension check_LTLIBRARIES = libdimension-tests.la -check_PROGRAMS = error-test \ - warning-test \ +check_PROGRAMS = warning-test \ + warning-as-error-test \ + error-test \ list-test \ polynomial-test \ prtree-test \ @@ -30,7 +31,7 @@ check_PROGRAMS = error-test \ render-test \ cxx-test TESTS = $(check_PROGRAMS) -XFAIL_TESTS = error-test +XFAIL_TESTS = warning-as-error-test error-test if !PNG XFAIL_TESTS += png-test @@ -50,12 +51,15 @@ else libdimension_tests_la_SOURCES += display-stubs.c endif -error_test_SOURCES = error.c -error_test_LDADD = libdimension-tests.la - warning_test_SOURCES = warning.c warning_test_LDADD = libdimension-tests.la +warning_as_error_test_SOURCES = warning-as-error.c +warning_as_error_test_LDADD = libdimension-tests.la + +error_test_SOURCES = error.c +error_test_LDADD = libdimension-tests.la + list_test_SOURCES = list.c list_test_LDADD = libdimension-tests.la diff --git a/tests/libdimension/cxx.cpp b/tests/libdimension/cxx.cpp index 0a4b44d..43517e1 100644 --- a/tests/libdimension/cxx.cpp +++ b/tests/libdimension/cxx.cpp @@ -26,6 +26,9 @@ int main(void) { + /* Treat warnings as errors for tests */ + dmnsn_die_on_warnings(true); + /* Make sure we can to bit-ops on this enum type */ dmnsn_quality quality = DMNSN_RENDER_PIGMENT | DMNSN_RENDER_LIGHTS; diff --git a/tests/libdimension/error.c b/tests/libdimension/error.c index e8100f0..3f25d0a 100644 --- a/tests/libdimension/error.c +++ b/tests/libdimension/error.c @@ -1,5 +1,5 @@ /************************************************************************* - * Copyright (C) 2009-2010 Tavian Barnes <tavianator@gmail.com> * + * Copyright (C) 2009-2011 Tavian Barnes <tavianator@gmail.com> * * * * This file is part of The Dimension Test Suite. * * * @@ -25,8 +25,6 @@ int main(void) { - dmnsn_set_resilience(DMNSN_SEVERITY_LOW); - dmnsn_error(DMNSN_SEVERITY_LOW, "This error is expected."); - + dmnsn_error("This error is expected."); return EXIT_SUCCESS; } diff --git a/tests/libdimension/gl.c b/tests/libdimension/gl.c index 581c380..662ae7b 100644 --- a/tests/libdimension/gl.c +++ b/tests/libdimension/gl.c @@ -1,5 +1,5 @@ /************************************************************************* - * Copyright (C) 2009-2010 Tavian Barnes <tavianator@gmail.com> * + * Copyright (C) 2009-2011 Tavian Barnes <tavianator@gmail.com> * * * * This file is part of The Dimension Test Suite. * * * @@ -23,8 +23,8 @@ int main(void) { - /* Set the resilience low for tests */ - dmnsn_set_resilience(DMNSN_SEVERITY_LOW); + /* Treat warnings as errors for tests */ + dmnsn_die_on_warnings(true); /* Allocate our canvas */ dmnsn_canvas *canvas = dmnsn_new_canvas(768, 480); diff --git a/tests/libdimension/list.c b/tests/libdimension/list.c index d8760a1..8f8819e 100644 --- a/tests/libdimension/list.c +++ b/tests/libdimension/list.c @@ -40,8 +40,8 @@ dmnsn_comparator(const dmnsn_list_iterator *i, const dmnsn_list_iterator *j) int main(void) { - /* Set the resilience low for tests */ - dmnsn_set_resilience(DMNSN_SEVERITY_LOW); + /* Treat warnings as errors for tests */ + dmnsn_die_on_warnings(true); dmnsn_list *list = dmnsn_new_list(sizeof(dmnsn_item)); diff --git a/tests/libdimension/png.c b/tests/libdimension/png.c index a3e4da8..33a3a67 100644 --- a/tests/libdimension/png.c +++ b/tests/libdimension/png.c @@ -1,5 +1,5 @@ /************************************************************************* - * Copyright (C) 2009-2010 Tavian Barnes <tavianator@gmail.com> * + * Copyright (C) 2009-2011 Tavian Barnes <tavianator@gmail.com> * * * * This file is part of The Dimension Test Suite. * * * @@ -24,8 +24,8 @@ int main(void) { - /* Set the resilience low for tests */ - dmnsn_set_resilience(DMNSN_SEVERITY_LOW); + /* Treat warnings as errors for tests */ + dmnsn_die_on_warnings(true); /* Allocate our canvas */ dmnsn_canvas *canvas = dmnsn_new_canvas(768, 480); diff --git a/tests/libdimension/polynomial.c b/tests/libdimension/polynomial.c index cc643f6..238f92d 100644 --- a/tests/libdimension/polynomial.c +++ b/tests/libdimension/polynomial.c @@ -28,8 +28,8 @@ int main(void) { - /* Set the resilience low for tests */ - dmnsn_set_resilience(DMNSN_SEVERITY_LOW); + /* Treat warnings as errors for tests */ + dmnsn_die_on_warnings(true); double poly[6], x[5]; /* poly[] = (x + 1)*(x - 1.2345)*(x - 2.3456)*(x - 5)*(x - 100) */ diff --git a/tests/libdimension/prtree.c b/tests/libdimension/prtree.c index aa7315b..ab6b78c 100644 --- a/tests/libdimension/prtree.c +++ b/tests/libdimension/prtree.c @@ -58,8 +58,8 @@ dmnsn_randomize_bounding_box(dmnsn_object *object) int main(void) { - /* Set the resilience low for tests */ - dmnsn_set_resilience(DMNSN_SEVERITY_LOW); + /* Treat warnings as errors for tests */ + dmnsn_die_on_warnings(true); const size_t nobjects = 128; dmnsn_scene *scene = dmnsn_new_scene(); diff --git a/tests/libdimension/render.c b/tests/libdimension/render.c index 3d2bd41..9e57916 100644 --- a/tests/libdimension/render.c +++ b/tests/libdimension/render.c @@ -204,8 +204,8 @@ dmnsn_new_test_scene(void) int main(void) { - /* Set the resilience low for tests */ - dmnsn_set_resilience(DMNSN_SEVERITY_LOW); + /* Treat warnings as errors for tests */ + dmnsn_die_on_warnings(true); /* Create the test scene */ dmnsn_scene *scene = dmnsn_new_test_scene(); diff --git a/tests/libdimension/warning-as-error.c b/tests/libdimension/warning-as-error.c new file mode 100644 index 0000000..ce274d3 --- /dev/null +++ b/tests/libdimension/warning-as-error.c @@ -0,0 +1,31 @@ +/************************************************************************* + * Copyright (C) 2009-2011 Tavian Barnes <tavianator@gmail.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/>. * + *************************************************************************/ + +/* Make sure warnings kill us in strict mode - this test should fail */ + +#include "dimension.h" +#include <stdlib.h> + +int +main(void) +{ + dmnsn_die_on_warnings(true); + dmnsn_warning("This warning is expected."); + return EXIT_SUCCESS; +} diff --git a/tests/libdimension/warning.c b/tests/libdimension/warning.c index 915c97a..593fe84 100644 --- a/tests/libdimension/warning.c +++ b/tests/libdimension/warning.c @@ -1,5 +1,5 @@ /************************************************************************* - * Copyright (C) 2009-2010 Tavian Barnes <tavianator@gmail.com> * + * Copyright (C) 2009-2011 Tavian Barnes <tavianator@gmail.com> * * * * This file is part of The Dimension Test Suite. * * * @@ -25,33 +25,6 @@ int main(void) { - if (dmnsn_get_resilience() != DMNSN_SEVERITY_MEDIUM) { - fprintf(stderr, "--- Wrong default resilience! ---\n"); - return EXIT_FAILURE; - } - - dmnsn_set_resilience(DMNSN_SEVERITY_LOW); - if (dmnsn_get_resilience() != DMNSN_SEVERITY_LOW) { - fprintf(stderr, "--- Resilience not updated! ---\n"); - return EXIT_FAILURE; - } - - dmnsn_set_resilience(DMNSN_SEVERITY_MEDIUM); - if (dmnsn_get_resilience() != DMNSN_SEVERITY_MEDIUM) { - fprintf(stderr, "--- Resilience not updated! ---\n"); - return EXIT_FAILURE; - } - - dmnsn_error(DMNSN_SEVERITY_LOW, "This warning is expected."); - - dmnsn_set_resilience(DMNSN_SEVERITY_HIGH); - if (dmnsn_get_resilience() != DMNSN_SEVERITY_HIGH) { - fprintf(stderr, "--- Resilience not updated! ---\n"); - return EXIT_FAILURE; - } - - dmnsn_error(DMNSN_SEVERITY_LOW, "This warning is expected."); - dmnsn_error(DMNSN_SEVERITY_MEDIUM, "This warning is expected."); - + dmnsn_warning("This warning is expected."); return EXIT_SUCCESS; } |