aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2018-11-03 06:06:36 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2018-11-03 06:06:36 +0000
commit45699400f09b0fe60543841f2105af25367ef53f (patch)
tree8cf7698a23f06afae6608fed06d419880c158d26 /src/test
parent504a1d8c0b68ba1235e2ffb56d957f23eb515a35 (diff)
downloadjackcess-45699400f09b0fe60543841f2105af25367ef53f.tar.gz
jackcess-45699400f09b0fe60543841f2105af25367ef53f.zip
implement replace function
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1215 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java16
1 files changed, 16 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 98aea88..4b6e388 100644
--- a/src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java
@@ -205,6 +205,22 @@ public class DefaultFunctionsTest extends TestCase
assertEquals(1.23d, eval("=Val(' 1 2 3 e -2 whatever')"));
assertEquals(0d, eval("=Val(' whatever123 ')"));
assertEquals(0d, eval("=Val('')"));
+
+ assertEquals("faa", eval("=Replace('foo','o','a')"));
+ assertEquals("faa", eval("=Replace('fOo','o','a')"));
+ assertEquals("aa", eval("=Replace('foo','o','a',2)"));
+ assertEquals("oo", eval("=Replace('foo','o','a',2,0)"));
+ assertEquals("", eval("=Replace('foo','o','a',4)"));
+ assertEquals("foo", eval("=Replace('foo','','a')"));
+ assertEquals("o", eval("=Replace('foo','','a',3)"));
+ assertEquals("fahhabahhaahha", eval("=Replace('fooboooo','OO','ahha')"));
+ assertEquals("fahhaboooo", eval("=Replace('fooboooo','OO','ahha',1,1)"));
+ assertEquals("fooboooo", eval("=Replace('fooboooo','OO','ahha',1,1,0)"));
+ assertEquals("ahhabahhaahha", eval("=Replace('fooboooo','OO','ahha',2)"));
+ assertEquals("obahhaahha", eval("=Replace('fooboooo','OO','ahha',3)"));
+ assertEquals("fb", eval("=Replace('fooboooo','OO','')"));
+ assertEquals("", eval("=Replace('','o','a')"));
+ assertEquals("foo", eval("=Replace('foo','foobar','a')"));
}
public void testNumberFuncs() throws Exception