summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-10-27 20:35:17 -0400
committerTavian Barnes <tavianator@gmail.com>2009-10-27 20:35:17 -0400
commitf6ce73bd76ee9b07bb13a6df9a5663a38ccf4013 (patch)
treef51f468548dae6ee78ff78bb0d43d9a914b1cdc3 /tests
parent50d844e91589a8f51cade42b732bcd1de889987b (diff)
downloaddimension-f6ce73bd76ee9b07bb13a6df9a5663a38ccf4013.tar.xz
Tokenize numeric values.
Diffstat (limited to 'tests')
-rw-r--r--tests/dimension/Makefile.am2
-rw-r--r--tests/dimension/numeric.pov2
-rwxr-xr-xtests/dimension/tokenizer.sh11
3 files changed, 13 insertions, 2 deletions
diff --git a/tests/dimension/Makefile.am b/tests/dimension/Makefile.am
index 7bacab5..e9b7f7a 100644
--- a/tests/dimension/Makefile.am
+++ b/tests/dimension/Makefile.am
@@ -25,4 +25,4 @@ TESTS_ENVIRONMENT = top_builddir=$(top_builddir)
tokenizer.sh:
cp $(srcdir)/tokenizer.sh .
-EXTRA_DIST = tokenizer.sh punctuation.pov
+EXTRA_DIST = tokenizer.sh punctuation.pov numeric.pov
diff --git a/tests/dimension/numeric.pov b/tests/dimension/numeric.pov
new file mode 100644
index 0000000..df850d6
--- /dev/null
+++ b/tests/dimension/numeric.pov
@@ -0,0 +1,2 @@
+1 123456789 01234567 0x123456789 -0x01
+.1 0.1 1.0 0.123456789 -0.123456789
diff --git a/tests/dimension/tokenizer.sh b/tests/dimension/tokenizer.sh
index d965741..edd3bb4 100755
--- a/tests/dimension/tokenizer.sh
+++ b/tests/dimension/tokenizer.sh
@@ -24,6 +24,15 @@ punctuation_exp='({ \( [ < + - * / , > ] \) })'
if [ "$punctuation" != "$punctuation_exp" ]; then
echo "punctuation.pov tokenized as \"$punctuation\"" >&2
- echo " -- expected \"$punctuation_exp\"" >&2
+ echo " -- expected \"$punctuation_exp\"" >&2
+ exit 1;
+fi
+
+numeric=$(${top_builddir}/dimension/dimension --tokenize ${srcdir}/numeric.pov)
+numeric_exp='((int "1") (int "123456789") (int "01234567") (int "0x123456789") - (int "0x01") (float ".1") (float "0.1") (float "1.0") (float "0.123456789") - (float "0.123456789"))'
+
+if [ "$numeric" != "$numeric_exp" ]; then
+ echo "numeric.pov tokenized as \"$numeric\"" >&2
+ echo " -- expected \"$numeric_exp\"" >&2
exit 1;
fi