summaryrefslogtreecommitdiff
path: root/test/baseline/opt-date.test
diff options
context:
space:
mode:
authortripun <tripun@gmail.com>2014-08-09 17:49:44 +0530
committerMartin Michlmayr <tbm@cyrius.com>2014-08-10 08:42:35 +0200
commit1132c78d343a197e357dcb791b0a7d1401455fe0 (patch)
treeae46e03067eba834c52d9a2c74fff64a9028b019 /test/baseline/opt-date.test
parentc4ea52ac85ddfc70a96d739b4d5d56177d96f792 (diff)
downloadfork-ledger-1132c78d343a197e357dcb791b0a7d1401455fe0.tar.gz
fork-ledger-1132c78d343a197e357dcb791b0a7d1401455fe0.tar.bz2
fork-ledger-1132c78d343a197e357dcb791b0a7d1401455fe0.zip
add test for --date expr
Diffstat (limited to 'test/baseline/opt-date.test')
-rw-r--r--test/baseline/opt-date.test50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/baseline/opt-date.test b/test/baseline/opt-date.test
index e69de29b..1290ce8f 100644
--- a/test/baseline/opt-date.test
+++ b/test/baseline/opt-date.test
@@ -0,0 +1,50 @@
+D 1000.00 GBP
+
+2011-03-04 Buy shares ; date: 2011-04-05
+ Assets:Broker 2 AAA @ 0.90 GBP
+ Assets:Bank
+
+2011-03-05 Buy shares ; date: 2011-04-06
+ Assets:Broker 2 AAA @ 1.00 GBP
+ Assets:Bank
+
+test reg --input-date-format '%Y-%m-%d' --date-format %d-%m-%Y --date 'has_tag("date") ? to_date(tag("date")) : date'
+05-04-2011 Buy shares Assets:Broker 2 AAA 2 AAA
+05-04-2011 Buy shares Assets:Bank -1.80 GBP 2 AAA
+ -1.80 GBP
+06-04-2011 Buy shares Assets:Broker 2 AAA 4 AAA
+ -1.80 GBP
+06-04-2011 Buy shares Assets:Bank -2.00 GBP 4 AAA
+ -3.80 GBP
+end test
+
+test reg --date 'date + 2'
+11-Mar-06 Buy shares Assets:Broker 2 AAA 2 AAA
+11-Mar-06 Buy shares Assets:Bank -1.80 GBP 2 AAA
+ -1.80 GBP
+11-Mar-07 Buy shares Assets:Broker 2 AAA 4 AAA
+ -1.80 GBP
+11-Mar-07 Buy shares Assets:Bank -2.00 GBP 4 AAA
+ -3.80 GBP
+end test
+
+test reg --date 'date - 2'
+11-Mar-02 Buy shares Assets:Broker 2 AAA 2 AAA
+11-Mar-02 Buy shares Assets:Bank -1.80 GBP 2 AAA
+ -1.80 GBP
+11-Mar-03 Buy shares Assets:Broker 2 AAA 4 AAA
+ -1.80 GBP
+11-Mar-03 Buy shares Assets:Bank -2.00 GBP 4 AAA
+ -3.80 GBP
+end test
+
+test reg --date 'date + 365*2'
+13-Mar-03 Buy shares Assets:Broker 2 AAA 2 AAA
+13-Mar-03 Buy shares Assets:Bank -1.80 GBP 2 AAA
+ -1.80 GBP
+13-Mar-04 Buy shares Assets:Broker 2 AAA 4 AAA
+ -1.80 GBP
+13-Mar-04 Buy shares Assets:Bank -2.00 GBP 4 AAA
+ -3.80 GBP
+end test
+