aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2018-10-29 00:55:17 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2018-10-29 00:55:17 +0000
commit45f64df5c56c518a9829f80cadf710f76e58e464 (patch)
tree069df3fe50f1b190a83faaa4885001ee14dde3f2 /src/test/java
parent8d5f4dc169c32bd91c7dec62c3e8c83ec9b3a6a9 (diff)
downloadjackcess-45f64df5c56c518a9829f80cadf710f76e58e464.tar.gz
jackcess-45f64df5c56c518a9829f80cadf710f76e58e464.zip
finish DateAdd function
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1213 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java17
1 files changed, 17 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 c3f5f68..5f0a045 100644
--- a/src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java
@@ -306,6 +306,23 @@ public class DefaultFunctionsTest extends TestCase
assertEquals(5, eval("=DatePart('h',#11/22/2003 5:45:13 AM#)"));
assertEquals(45, eval("=DatePart('n',#11/22/2003 5:45:13 AM#)"));
assertEquals(13, eval("=DatePart('s',#11/22/2003 5:45:13 AM#)"));
+
+ assertEquals("11/22/2005 5:45:13 AM", eval("CStr(DateAdd('yyyy',2,#11/22/2003 5:45:13 AM#))"));
+ assertEquals("2/22/2004 5:45:13 AM", eval("CStr(DateAdd('q',1,#11/22/2003 5:45:13 AM#))"));
+ assertEquals("1/22/2004 5:45:13 AM", eval("CStr(DateAdd('m',2,#11/22/2003 5:45:13 AM#))"));
+ assertEquals("12/12/2003 5:45:13 AM", eval("CStr(DateAdd('d',20,#11/22/2003 5:45:13 AM#))"));
+ assertEquals("12/12/2003 5:45:13 AM", eval("CStr(DateAdd('w',20,#11/22/2003 5:45:13 AM#))"));
+ assertEquals("12/12/2003 5:45:13 AM", eval("CStr(DateAdd('y',20,#11/22/2003 5:45:13 AM#))"));
+ assertEquals("12/27/2003 5:45:13 AM", eval("CStr(DateAdd('ww',5,#11/22/2003 5:45:13 AM#))"));
+ assertEquals("11/22/2003 3:45:13 PM", eval("CStr(DateAdd('h',10,#11/22/2003 5:45:13 AM#))"));
+ assertEquals("11/22/2003 6:19:13 AM", eval("CStr(DateAdd('n',34,#11/22/2003 5:45:13 AM#))"));
+ assertEquals("11/22/2003 5:46:27 AM", eval("CStr(DateAdd('s',74,#11/22/2003 5:45:13 AM#))"));
+
+ assertEquals("12/12/2003", eval("CStr(DateAdd('d',20,#11/22/2003#))"));
+ assertEquals("11/22/2003 10:00:00 AM", eval("CStr(DateAdd('h',10,#11/22/2003#))"));
+ assertEquals("11/23/2003", eval("CStr(DateAdd('h',24,#11/22/2003#))"));
+ assertEquals("3:45:13 PM", eval("CStr(DateAdd('h',10,#5:45:13 AM#))"));
+ assertEquals("12/31/1899 11:45:13 AM", eval("CStr(DateAdd('h',30,#5:45:13 AM#))"));
}
public void testFinancialFuncs() throws Exception