diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2018-06-29 03:20:36 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2018-06-29 03:20:36 +0000 |
commit | 0a182fbac9910fa434b2557064673ccfa75174f0 (patch) | |
tree | ae851625568217f1f3e4c626cf21dc618b124c4a | |
parent | 08d2cf2b83b6af3ac056055c8faa049007825eab (diff) | |
download | jackcess-0a182fbac9910fa434b2557064673ccfa75174f0.tar.gz jackcess-0a182fbac9910fa434b2557064673ccfa75174f0.zip |
more tests
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1177 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r-- | src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java | 1 | ||||
-rw-r--r-- | src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java | 35 |
2 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java b/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java index 2a5627d..7bd7396 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/expr/Expressionator.java @@ -923,6 +923,7 @@ public class Expressionator buf.next(); t = buf.peekNext(); if(isString(t, "null")) { + buf.next(); return SpecOp.IS_NOT_NULL; } } 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 41edb6c..227ffdc 100644 --- a/src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java +++ b/src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java @@ -45,6 +45,9 @@ public class ExpressionatorTest extends TestCase -1.0000002d,-1.0d,-0.0002013d,0.0d, 0.9234d,1.0d,1.954d,2.200032d,3.001d, 4.9321d,5.0d,6.66666d,7.396d,8.1d,9.20456200d,10.325d}; + private static final int TRUE_NUM = -1; + private static final int FALSE_NUM = 0; + public ExpressionatorTest(String name) { super(name); } @@ -273,6 +276,36 @@ public class ExpressionatorTest extends TestCase } } + public void testComparison() throws Exception + { + assertEquals(TRUE_NUM, eval("='blah'<'fuzz'")); + assertEquals(FALSE_NUM, eval("=23>56")); + assertEquals(TRUE_NUM, eval("=13.2<=45.8")); + assertEquals(FALSE_NUM, eval("='blah'='fuzz'")); + assertEquals(TRUE_NUM, eval("='blah'<>'fuzz'")); + assertEquals(TRUE_NUM, eval("=CDbl(13.2)<=CDbl(45.8)")); + + assertEquals(FALSE_NUM, eval("='blah' Is Null")); + assertEquals(TRUE_NUM, eval("='blah' Is Not Null")); + + assertEquals(TRUE_NUM, eval("='blah' Between 'a' And 'z'")); + assertEquals(FALSE_NUM, eval("='blah' Not Between 'a' And 'z'")); + + assertEquals(TRUE_NUM, eval("='blah' In ('foo','bar','blah')")); + assertEquals(FALSE_NUM, eval("='blah' Not In ('foo','bar','blah')")); + + assertEquals(TRUE_NUM, eval("=True Xor False")); + assertEquals(TRUE_NUM, eval("=True Or False")); + assertEquals(FALSE_NUM, eval("=True Imp False")); + assertEquals(FALSE_NUM, eval("=True Eqv False")); + assertEquals(TRUE_NUM, eval("=Not(True Eqv False)")); + } + + public void testDateArith() throws Exception + { + assertEquals(new Date(1041508800000L), eval("=#01/02/2003# + #7:00:00#")); + } + public void testTrickyMathExpressions() throws Exception { assertEquals(37, eval("=30+7")); @@ -323,6 +356,8 @@ public class ExpressionatorTest extends TestCase "<THIS_COL> Like \"[abc*\""); assertFalse(evalCondition("Like \"[abc*\"", "afcd")); assertFalse(evalCondition("Like \"[abc*\"", "fcd")); + // FIXME, does access support "not like" + //assertTrue(evalCondition("Not Like \"[abc*\"", "fcd")); assertFalse(evalCondition("Like \"[abc*\"", "")); } |