aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2018-07-01 04:53:06 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2018-07-01 04:53:06 +0000
commit17d5d661ac7d4ca3f59747b9f6a992b16ea8e3cd (patch)
tree098d50f3df1266025908a47903a871b02d7c2818 /src/test
parent0a182fbac9910fa434b2557064673ccfa75174f0 (diff)
downloadjackcess-17d5d661ac7d4ca3f59747b9f6a992b16ea8e3cd.tar.gz
jackcess-17d5d661ac7d4ca3f59747b9f6a992b16ea8e3cd.zip
add more tests; add not like
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1178 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java48
1 files changed, 46 insertions, 2 deletions
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 227ffdc..ef5cef3 100644
--- a/src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/impl/expr/ExpressionatorTest.java
@@ -280,6 +280,7 @@ public class ExpressionatorTest extends TestCase
{
assertEquals(TRUE_NUM, eval("='blah'<'fuzz'"));
assertEquals(FALSE_NUM, eval("=23>56"));
+ 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'"));
@@ -288,7 +289,11 @@ public class ExpressionatorTest extends TestCase
assertEquals(FALSE_NUM, eval("='blah' Is Null"));
assertEquals(TRUE_NUM, eval("='blah' Is Not Null"));
+ assertEquals(TRUE_NUM, eval("=Null Is Null"));
+ assertEquals(FALSE_NUM, eval("=Null Is Not Null"));
+
assertEquals(TRUE_NUM, eval("='blah' Between 'a' And 'z'"));
+ assertEquals(TRUE_NUM, eval("='blah' Between 'z' And 'a'"));
assertEquals(FALSE_NUM, eval("='blah' Not Between 'a' And 'z'"));
assertEquals(TRUE_NUM, eval("='blah' In ('foo','bar','blah')"));
@@ -296,6 +301,7 @@ public class ExpressionatorTest extends TestCase
assertEquals(TRUE_NUM, eval("=True Xor False"));
assertEquals(TRUE_NUM, eval("=True Or False"));
+ assertEquals(TRUE_NUM, eval("=False Or True"));
assertEquals(FALSE_NUM, eval("=True Imp False"));
assertEquals(FALSE_NUM, eval("=True Eqv False"));
assertEquals(TRUE_NUM, eval("=Not(True Eqv False)"));
@@ -304,6 +310,45 @@ public class ExpressionatorTest extends TestCase
public void testDateArith() throws Exception
{
assertEquals(new Date(1041508800000L), eval("=#01/02/2003# + #7:00:00#"));
+ assertEquals(new Date(1041458400000L), eval("=#01/02/2003# - #7:00:00#"));
+ assertEquals(new Date(1044680400000L), eval("=#01/02/2003# + '37'"));
+ assertEquals(new Date(1044680400000L), eval("='37' + #01/02/2003#"));
+ assertEquals(new Date(1041508800000L), eval("=#01/02/2003 7:00:00#"));
+ }
+
+ public void testNull() throws Exception
+ {
+ assertNull(eval("=37 + Null"));
+ assertNull(eval("=37 - Null"));
+ assertNull(eval("=37 / Null"));
+ assertNull(eval("=37 * Null"));
+ assertNull(eval("=37 ^ Null"));
+ assertEquals("37", eval("=37 & Null"));
+ assertEquals("37", eval("=Null & 37"));
+ assertNull(eval("=37 Mod Null"));
+ assertNull(eval("=37 \\ Null"));
+ assertNull(eval("=-(Null)"));
+ assertNull(eval("=+(Null)"));
+ assertNull(eval("=Not Null"));
+ assertEquals(TRUE_NUM, eval("=37 Or Null"));
+ assertNull(eval("=Null Or 37"));
+ assertNull(eval("=37 And Null"));
+ assertNull(eval("=Null And 37"));
+ assertNull(eval("=37 Xor Null"));
+ assertNull(eval("=37 Imp Null"));
+ assertNull(eval("=Null Imp Null"));
+ assertEquals(TRUE_NUM, eval("=Null Imp 37"));
+ assertNull(eval("=37 Eqv Null"));
+ assertNull(eval("=37 < Null"));
+ assertNull(eval("=37 > Null"));
+ assertNull(eval("=37 = Null"));
+ assertNull(eval("=37 <> Null"));
+ assertNull(eval("=37 <= Null"));
+ assertNull(eval("=37 >= Null"));
+
+ assertNull(eval("=37 Between Null And 54"));
+ assertEquals(FALSE_NUM, eval("=37 In (23, Null, 45)"));
+ assertNull(eval("=Null In (23, Null, 45)"));
}
public void testTrickyMathExpressions() throws Exception
@@ -356,8 +401,7 @@ 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"));
+ assertTrue(evalCondition("Not Like \"[abc*\"", "fcd"));
assertFalse(evalCondition("Like \"[abc*\"", ""));
}