From 8ce6029a6a14c0ef003c88cb9fb29e522c022f9c Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 28 Oct 2009 18:57:31 -0400 Subject: Tokenize strings and language directives. --- tests/dimension/directives.pov | 24 ++++++++++++++++++++++++ tests/dimension/strings.pov | 21 +++++++++++++++++++++ tests/dimension/tokenizer.sh | 19 +++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 tests/dimension/directives.pov create mode 100644 tests/dimension/strings.pov (limited to 'tests') diff --git a/tests/dimension/directives.pov b/tests/dimension/directives.pov new file mode 100644 index 0000000..eebedaa --- /dev/null +++ b/tests/dimension/directives.pov @@ -0,0 +1,24 @@ +/************************************************************************* + * Copyright (C) 2009 Tavian Barnes * + * * + * 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 . * + *************************************************************************/ + +// Test the language directives + +#include "punctuation.pov" + +#declare x \ No newline at end of file diff --git a/tests/dimension/strings.pov b/tests/dimension/strings.pov new file mode 100644 index 0000000..307b774 --- /dev/null +++ b/tests/dimension/strings.pov @@ -0,0 +1,21 @@ +/************************************************************************* + * Copyright (C) 2009 Tavian Barnes * + * * + * 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 . * + *************************************************************************/ + +// Test string handling, including escape sequences +"This is a string with\n\"escape sequences\"\\" diff --git a/tests/dimension/tokenizer.sh b/tests/dimension/tokenizer.sh index 6d67da3..f1f2b6b 100755 --- a/tests/dimension/tokenizer.sh +++ b/tests/dimension/tokenizer.sh @@ -39,6 +39,16 @@ if [ "$numeric" != "$numeric_exp" ]; then exitstatus=1 fi +strings=$(${top_builddir}/dimension/dimension --tokenize ${srcdir}/strings.pov) +strings_exp='((string "This is a string with +"escape sequences"\"))' + +if [ "$strings" != "$strings_exp" ]; then + echo "strings.pov tokenized as \"$strings\"" >&2 + echo " -- expected \"$strings_exp\"" >&2 + exitstatus=1 +fi + labels=$(${top_builddir}/dimension/dimension --tokenize ${srcdir}/labels.pov) labels_exp='(camera { } sphere { color (identifier "new_identifier") } box { color (identifier "new_identifier") })'; @@ -48,4 +58,13 @@ if [ "$labels" != "$labels_exp" ]; then exitstatus=1 fi +directives=$(${top_builddir}/dimension/dimension --tokenize ${srcdir}/directives.pov) +directives_exp='(#include (string "punctuation.pov") #declare (identifier "x"))'; + +if [ "$directives" != "$directives_exp" ]; then + echo "directives.pov tokenized as \"$directives\"" >&2 + echo " -- expected \"$directives_exp\"" >&2 + exitstatus=1 +fi + exit $exitstatus -- cgit v1.2.3