aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2018-09-18 02:55:40 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2018-09-18 02:55:40 +0000
commit010cc904a5ab759f24825f34f2924c347b3b2790 (patch)
tree7cb6358c8ef9621673754e13d5d62c89b7051561 /src/test
parent8d5ae34b81cfc38744be68ebd9871359a8e6cbe8 (diff)
downloadjackcess-010cc904a5ab759f24825f34f2924c347b3b2790.tar.gz
jackcess-010cc904a5ab759f24825f34f2924c347b3b2790.zip
implement IsNumeric; add support for hex/oct integer strings
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1199 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java14
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java4
2 files changed, 18 insertions, 0 deletions
diff --git a/src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java b/src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java
index ca1a67c..e8aa234 100644
--- a/src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java
@@ -80,7 +80,21 @@ public class DefaultFunctionsTest extends TestCase
assertEquals("-42", eval("=CStr(-42)"));
assertEquals(-1, eval("=IsNull(Null)"));
+ assertEquals(0, eval("=IsNull(13)"));
assertEquals(-1, eval("=IsDate(#01/02/2003#)"));
+ assertEquals(0, eval("=IsDate('foo')"));
+
+ assertEquals(0, eval("=IsNumeric(Null)"));
+ assertEquals(0, eval("=IsNumeric('foo')"));
+ assertEquals(0, eval("=IsNumeric(#01/02/2003#)"));
+ assertEquals(-1, eval("=IsNumeric(37)"));
+ assertEquals(-1, eval("=IsNumeric(' 37 ')"));
+ assertEquals(-1, eval("=IsNumeric(' -37.5e2 ')"));
+ assertEquals(-1, eval("=IsNumeric(' &H37 ')"));
+ assertEquals(0, eval("=IsNumeric(' &H37foo ')"));
+ assertEquals(0, eval("=IsNumeric(' &o39 ')"));
+ assertEquals(-1, eval("=IsNumeric(' &o36 ')"));
+ assertEquals(0, eval("=IsNumeric(' &o36.1 ')"));
assertEquals(1, eval("=VarType(Null)"));
assertEquals(8, eval("=VarType('blah')"));
diff --git a/src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java b/src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java
index 188172d..5b623a0 100644
--- a/src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java
@@ -383,6 +383,10 @@ public class ExpressionatorTest extends TestCase
assertEquals(37d, eval("=\"25\" + 12"));
assertEquals(37d, eval("=12 + \"25\""));
+ assertEquals(37d, eval("=\" 25 \" + 12"));
+ assertEquals(37d, eval("=\" &h1A \" + 11"));
+ assertEquals(37d, eval("=\" &h1a \" + 11"));
+ assertEquals(37d, eval("=\" &O32 \" + 11"));
evalFail(("=12 - \"foo\""), RuntimeException.class);
evalFail(("=\"foo\" - 12"), RuntimeException.class);