diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-02-28 16:28:21 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-03-08 21:43:18 -0500 |
commit | a2bf45329a172d2c53594c64d27f1c15ac26796a (patch) | |
tree | 93c6c3e7404e4abc605c410f978aefa3dd3231fa /tests | |
parent | f69c955c28b7e5c2eaf4af036cb88480a8e433f3 (diff) | |
download | dimension-a2bf45329a172d2c53594c64d27f1c15ac26796a.tar.xz |
New dmnsn_warning() API, remove different severities.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/dimension/arithexp.sh | 4 | ||||
-rwxr-xr-x | tests/dimension/csg.sh | 6 | ||||
-rwxr-xr-x | tests/dimension/demo.sh | 6 | ||||
-rwxr-xr-x | tests/dimension/directives.sh | 4 | ||||
-rwxr-xr-x | tests/dimension/integer-overflow.sh | 4 | ||||
-rwxr-xr-x | tests/dimension/invalid-macro.sh | 4 | ||||
-rwxr-xr-x | tests/dimension/labels.sh | 4 | ||||
-rwxr-xr-x | tests/dimension/numeric.sh | 4 | ||||
-rwxr-xr-x | tests/dimension/punctuation.sh | 4 | ||||
-rwxr-xr-x | tests/dimension/strings.sh | 4 | ||||
-rwxr-xr-x | tests/dimension/tbuffer-overlap.sh | 4 | ||||
-rwxr-xr-x | tests/dimension/transformations.sh | 6 | ||||
-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 |
23 files changed, 89 insertions, 80 deletions
diff --git a/tests/dimension/arithexp.sh b/tests/dimension/arithexp.sh index c5be884..3f47020 100755 --- a/tests/dimension/arithexp.sh +++ b/tests/dimension/arithexp.sh @@ -1,7 +1,7 @@ #!/bin/sh ######################################################################### -# 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. # # # @@ -19,7 +19,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### -arithexp=$(${top_builddir}/dimension/dimension --parse ${srcdir}/arithexp.pov) +arithexp=$(${top_builddir}/dimension/dimension --strict --parse ${srcdir}/arithexp.pov) arithexp_exp="$(echo -n \ '((object (sphere diff --git a/tests/dimension/csg.sh b/tests/dimension/csg.sh index 8a45a78..f282335 100755 --- a/tests/dimension/csg.sh +++ b/tests/dimension/csg.sh @@ -1,7 +1,7 @@ #!/bin/sh ######################################################################### -# Copyright (C) 2010 Tavian Barnes <tavianator@gmail.com> # +# Copyright (C) 2010-2011 Tavian Barnes <tavianator@gmail.com> # # # # This file is part of The Dimension Test Suite. # # # @@ -19,7 +19,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### -csg=$(${top_builddir}/dimension/dimension -w768 -h480 --parse ${srcdir}/csg.pov) +csg=$(${top_builddir}/dimension/dimension --strict -w768 -h480 --parse ${srcdir}/csg.pov) csg_exp="$(echo -n \ '((camera perspective @@ -91,4 +91,4 @@ if [ "$csg" != "$csg_exp" ]; then exit 1 fi -${top_builddir}/dimension/dimension -w768 -h480 -o csg.png ${srcdir}/csg.pov +${top_builddir}/dimension/dimension --strict -w768 -h480 -o csg.png ${srcdir}/csg.pov diff --git a/tests/dimension/demo.sh b/tests/dimension/demo.sh index 80d5ade..b80adec 100755 --- a/tests/dimension/demo.sh +++ b/tests/dimension/demo.sh @@ -1,7 +1,7 @@ #!/bin/sh ######################################################################### -# 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. # # # @@ -19,7 +19,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### -demo=$(${top_builddir}/dimension/dimension -w768 -h480 --parse ${srcdir}/demo.pov) +demo=$(${top_builddir}/dimension/dimension --strict -w768 -h480 --parse ${srcdir}/demo.pov) demo_exp=$(echo -n \ '((camera perspective @@ -214,4 +214,4 @@ if [ "$demo" != "$demo_exp" ]; then exit 1 fi -${top_builddir}/dimension/dimension -w768 -h480 -o demo.png ${srcdir}/demo.pov +${top_builddir}/dimension/dimension --strict -w768 -h480 -o demo.png ${srcdir}/demo.pov diff --git a/tests/dimension/directives.sh b/tests/dimension/directives.sh index 3e0233c..079e3e1 100755 --- a/tests/dimension/directives.sh +++ b/tests/dimension/directives.sh @@ -1,7 +1,7 @@ #!/bin/sh ######################################################################### -# 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. # # # @@ -19,7 +19,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### -directives=$(${top_builddir}/dimension/dimension --tokenize --parse ${srcdir}/directives.pov) +directives=$(${top_builddir}/dimension/dimension --strict --tokenize --parse ${srcdir}/directives.pov) directives_exp="$(echo -n \ '(#version (float "3.6") ; #debug (string "debug") diff --git a/tests/dimension/integer-overflow.sh b/tests/dimension/integer-overflow.sh index 737c0e2..cdb3685 100755 --- a/tests/dimension/integer-overflow.sh +++ b/tests/dimension/integer-overflow.sh @@ -1,7 +1,7 @@ #!/bin/sh ######################################################################### -# 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. # # # @@ -19,7 +19,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### -integer_overflow=$(${top_builddir}/dimension/dimension --parse ${srcdir}/integer-overflow.pov) +integer_overflow=$(${top_builddir}/dimension/dimension --strict --parse ${srcdir}/integer-overflow.pov) integer_overflow_exp="$(echo -n \ '((object (torus diff --git a/tests/dimension/invalid-macro.sh b/tests/dimension/invalid-macro.sh index 30186fb..144cb21 100755 --- a/tests/dimension/invalid-macro.sh +++ b/tests/dimension/invalid-macro.sh @@ -1,7 +1,7 @@ #!/bin/sh ######################################################################### -# 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. # # # @@ -19,5 +19,5 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### -${top_builddir}/dimension/dimension --parse ${srcdir}/invalid-macro.pov +${top_builddir}/dimension/dimension --strict --parse ${srcdir}/invalid-macro.pov [ $? -lt 128 -a $? -gt 0 ] diff --git a/tests/dimension/labels.sh b/tests/dimension/labels.sh index c6e99b1..83b2f05 100755 --- a/tests/dimension/labels.sh +++ b/tests/dimension/labels.sh @@ -1,7 +1,7 @@ #!/bin/sh ######################################################################### -# 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. # # # @@ -19,7 +19,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### -labels=$(${top_builddir}/dimension/dimension --tokenize ${srcdir}/labels.pov) +labels=$(${top_builddir}/dimension/dimension --strict --tokenize ${srcdir}/labels.pov) labels_exp='(camera { } sphere { color (identifier "new_identifier") } box { color (identifier "new_identifier") })'; if [ "$labels" != "$labels_exp" ]; then diff --git a/tests/dimension/numeric.sh b/tests/dimension/numeric.sh index 0f9c7ef..6baca70 100755 --- a/tests/dimension/numeric.sh +++ b/tests/dimension/numeric.sh @@ -1,7 +1,7 @@ #!/bin/sh ######################################################################### -# 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. # # # @@ -19,7 +19,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### -numeric=$(${top_builddir}/dimension/dimension --tokenize ${srcdir}/numeric.pov) +numeric=$(${top_builddir}/dimension/dimension --strict --tokenize ${srcdir}/numeric.pov) numeric_exp=$(echo -n \ '((integer "1") (integer "123456789") diff --git a/tests/dimension/punctuation.sh b/tests/dimension/punctuation.sh index 339caef..2fde521 100755 --- a/tests/dimension/punctuation.sh +++ b/tests/dimension/punctuation.sh @@ -1,7 +1,7 @@ #!/bin/sh ######################################################################### -# 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. # # # @@ -19,7 +19,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### -punctuation=$(${top_builddir}/dimension/dimension --tokenize ${srcdir}/punctuation.pov) +punctuation=$(${top_builddir}/dimension/dimension --strict --tokenize ${srcdir}/punctuation.pov) punctuation_exp='({ } \( \) [ ] + - * / , ; ? : & . | = < > ! <= >= !=)' if [ "$punctuation" != "$punctuation_exp" ]; then diff --git a/tests/dimension/strings.sh b/tests/dimension/strings.sh index f9a1cfd..2fee2c6 100755 --- a/tests/dimension/strings.sh +++ b/tests/dimension/strings.sh @@ -1,7 +1,7 @@ #!/bin/sh ######################################################################### -# 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. # # # @@ -19,7 +19,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### -strings=$(${top_builddir}/dimension/dimension --tokenize ${srcdir}/strings.pov) +strings=$(${top_builddir}/dimension/dimension --strict --tokenize ${srcdir}/strings.pov) strings_exp=$(/bin/echo -e "((string \"This is a string with escape sequences: \a\b\f\n\r\t!#\v\\\'\"\"))") if [ "$strings" != "$strings_exp" ]; then diff --git a/tests/dimension/tbuffer-overlap.sh b/tests/dimension/tbuffer-overlap.sh index 8e5f52e..83a65d7 100755 --- a/tests/dimension/tbuffer-overlap.sh +++ b/tests/dimension/tbuffer-overlap.sh @@ -1,7 +1,7 @@ #!/bin/sh ######################################################################### -# 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. # # # @@ -19,5 +19,5 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### -${top_builddir}/dimension/dimension --parse ${srcdir}/tbuffer-overlap.pov +${top_builddir}/dimension/dimension --strict --parse ${srcdir}/tbuffer-overlap.pov [ $? -lt 128 -a $? -gt 0 ] diff --git a/tests/dimension/transformations.sh b/tests/dimension/transformations.sh index 462dbeb..e53d9cf 100755 --- a/tests/dimension/transformations.sh +++ b/tests/dimension/transformations.sh @@ -1,7 +1,7 @@ #!/bin/sh ######################################################################### -# 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. # # # @@ -19,7 +19,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### -transformations=$(${top_builddir}/dimension/dimension --parse ${srcdir}/transformations.pov) +transformations=$(${top_builddir}/dimension/dimension --strict --parse ${srcdir}/transformations.pov) transformations_exp="$(echo -n \ '((object (sphere @@ -61,4 +61,4 @@ if [ "$transformations" != "$transformations_exp" ]; then exit 1 fi -${top_builddir}/dimension/dimension -w1 -h1 -o /dev/null ${srcdir}/transformations.pov +${top_builddir}/dimension/dimension --strict -w1 -h1 -o /dev/null ${srcdir}/transformations.pov 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; } |