From f6ce73bd76ee9b07bb13a6df9a5663a38ccf4013 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 27 Oct 2009 20:35:17 -0400 Subject: Tokenize numeric values. --- tests/dimension/Makefile.am | 2 +- tests/dimension/numeric.pov | 2 ++ tests/dimension/tokenizer.sh | 11 ++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 tests/dimension/numeric.pov (limited to 'tests/dimension') 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 -- cgit v1.2.3