summaryrefslogtreecommitdiff
path: root/test/regress/1176.test
diff options
context:
space:
mode:
authorRafael Ascensão <rafa.almas@gmail.com>2021-09-25 23:47:08 +0100
committerMartin Michlmayr <tbm@cyrius.com>2021-09-27 13:14:17 +0800
commited5886921bcce0d1a261a37aa83bf135259b7d21 (patch)
tree1bdf9179310ed0ecd57c471403e2b3c2aaabb033 /test/regress/1176.test
parent24ba762f5cc5e13e02de54450f13ac4ccb639bee (diff)
downloadfork-ledger-ed5886921bcce0d1a261a37aa83bf135259b7d21.tar.gz
fork-ledger-ed5886921bcce0d1a261a37aa83bf135259b7d21.tar.bz2
fork-ledger-ed5886921bcce0d1a261a37aa83bf135259b7d21.zip
Fix --time-colon for negative time amounts
While the current formula works for positive numbers, negative numbers are incorrectly represented. One of the issues comes from the fact that floor(x) < x for every x. `amount_t precision` will always be a non negative number and the code that attempts to fix the issue for negative number will never run. If we truncate the number instead, the current formula works for both positive and negative numbers without making negative numbers a corner case. So let's do that. Signed-off-by: Rafael Ascensão <rafa.almas@gmail.com>
Diffstat (limited to 'test/regress/1176.test')
-rw-r--r--test/regress/1176.test23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/regress/1176.test b/test/regress/1176.test
new file mode 100644
index 00000000..6c23c8bd
--- /dev/null
+++ b/test/regress/1176.test
@@ -0,0 +1,23 @@
+2016-01-01 Employer
+ Me -5400s
+ Them 5400s
+2016-01-01 Employer
+ Me -3600s
+ Them 3600s
+2016-01-02 Employer
+ Me -1800s
+ Them 1800s
+2016-01-02 Employer
+ Me -30s
+ Them 30s
+
+test reg --time-colon
+16-Jan-01 Employer Me -1:30h -1:30h
+ Them 1:30h 0
+16-Jan-01 Employer Me -1:00h -1:00h
+ Them 1:00h 0
+16-Jan-02 Employer Me -30:0m -30:0m
+ Them 30:0m 0
+16-Jan-02 Employer Me -30s -30s
+ Them 30s 0
+end test