aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2019-01-30 00:49:32 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2019-01-30 00:49:32 +0000
commit229464aff25cee0ff6941174fefd4e3416800f9f (patch)
tree65e89d30a1a41051fe6a749fa2f662f838229be1 /src/test/java
parentf3c8bb34a4aad19a5879d193dc54bfe862bd94b1 (diff)
downloadjackcess-229464aff25cee0ff6941174fefd4e3416800f9f.tar.gz
jackcess-229464aff25cee0ff6941174fefd4e3416800f9f.zip
more tests, more bug fixes for custom formats
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/jdk8@1270 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java50
1 files changed, 41 insertions, 9 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 24f3c5b..7275fb2 100644
--- a/src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java
+++ b/src/test/java/com/healthmarketscience/jackcess/impl/expr/DefaultFunctionsTest.java
@@ -347,6 +347,8 @@ public class DefaultFunctionsTest extends TestCase
"=Format('3.9', '*~dddd, yy mmm d, hh:nn:ss \\Y[Yellow]')");
assertEval("Tuesday, 00 Jan 01/2, 09:36:00 PM",
"=Format('3.9', 'dddd, yy mmm mm/d, hh:nn:ss AMPM')");
+ assertEval("9:36:00 PM",
+ "=Format('3.9', 'ttttt')");
assertEval("foo",
"=Format('foo', 'dddd, yy mmm mm d, hh:nn:ss AMPM')");
@@ -390,24 +392,46 @@ public class DefaultFunctionsTest extends TestCase
"", "''",
"", "Null");
- assertEvalFormat("'\"p\"#.00#\"blah\";(\"p\"#.00#\"blah\");\"zero\";\"yuck\"'",
+ assertEvalFormat("'\\p#.00#\"blah\";*~(\"p\"#.00#\"blah\");\"zero\";\"yuck\"'",
"p13.00blah", "13",
"(p13.00blah)", "-13",
"zero", "0",
"", "''",
"yuck", "Null");
- assertEvalFormat("'0.##;(0.###);\"zero\";\"yuck\"'",
+ assertEvalFormat("'0.##;(0.###);\"zero\";\"yuck\";'",
"0.03", "0.03",
"zero", "0.003",
"(0.003)", "-0.003",
"zero", "-0.0003");
- // FIXME, need to handle rounding w/ negatives
- // FIXME, need to handle dangling decimal
- // assertEvalFormat("'0.##;(0.###E+0)'",
- // "0.03", "0.03",
- // "(0.003)", "-0.0003",
+ assertEvalFormat("'0.##;(0.###E+0)'",
+ "0.03", "0.03",
+ "(3.E-4)", "-0.0003",
+ "0.", "0",
+ "34223.", "34223",
+ "(3.422E+4)", "-34223");
+
+ assertEvalFormat("'0.###E-0'",
+ "3.E-4", "0.0003",
+ "3.422E4", "34223"
+ );
+
+ assertEvalFormat("'0.###e+0'",
+ "3.e-4", "0.0003",
+ "3.422e+4", "34223"
+ );
+
+ assertEvalFormat("'0.###e-0'",
+ "3.e-4", "0.0003",
+ "3.422e4", "34223"
+ );
+
+ assertEvalFormat("'#,##0.###'",
+ "0.003", "0.003",
+ "0.", "0.0003",
+ "34,223.", "34223"
+ );
assertEvalFormat("'0.'",
"13.", "13",
@@ -434,6 +458,14 @@ public class DefaultFunctionsTest extends TestCase
"0", "0"
);
+ assertEvalFormat("'%0'",
+ "%13", "0.13",
+ "%0", "0.003",
+ "-%45", "-0.45",
+ "%0", "-0.003",
+ "%0", "0"
+ );
+
assertEvalFormat("'#'",
"13", "13",
"0", "0.003",
@@ -467,14 +499,14 @@ public class DefaultFunctionsTest extends TestCase
"", "''",
"", "Null");
- assertEvalFormat("'!>@'",
+ assertEvalFormat("'!>@;'",
"O", "'foo'",
"3", "-13",
"0", "0",
"", "''",
"", "Null");
- assertEvalFormat("'!>@[Red];\"empty\"'",
+ assertEvalFormat("'!>*~@[Red];\"empty\";'",
"O", "'foo'",
"3", "-13",
"0", "0",