summaryrefslogtreecommitdiff
path: root/lulua/test_report.py
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2020-02-29 09:24:00 +0100
committerLars-Dominik Braun <lars@6xq.net>2020-02-29 09:24:47 +0100
commit3f9f918c93a92350c76a761af85abf003737fc30 (patch)
tree3b96772a05413bef80775cd95176f05469eca0ac /lulua/test_report.py
parent102fd5aafa4f36572ae9f1d8083e058b0f47676c (diff)
downloadlulua-3f9f918c93a92350c76a761af85abf003737fc30.tar.gz
lulua-3f9f918c93a92350c76a761af85abf003737fc30.tar.bz2
lulua-3f9f918c93a92350c76a761af85abf003737fc30.zip
Fix function approx and its testcase
Function was moved and changed by commit 0f8643954fd9507aec85bab46046e71a497bfffe, but the testcase was not.
Diffstat (limited to 'lulua/test_report.py')
-rw-r--r--lulua/test_report.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/lulua/test_report.py b/lulua/test_report.py
new file mode 100644
index 0000000..816aa85
--- /dev/null
+++ b/lulua/test_report.py
@@ -0,0 +1,20 @@
+from decimal import Decimal
+
+from .report import approx
+
+def test_approx ():
+ assert approx (0) == (Decimal ('0'), '')
+ assert approx (0.01) == (Decimal ('0'), '')
+ assert approx (0.05) == (Decimal ('0.1'), '')
+ assert approx (1) == (Decimal ('1'), '')
+ assert approx (100) == (Decimal ('100'), '')
+ assert approx (999.9) == (Decimal ('999.9'), '')
+ assert approx (999.91) == (Decimal ('999.9'), '')
+ assert approx (999.99) == (Decimal ('1'), 'thousand')
+
+ assert approx (10**3) == (Decimal ('1'), 'thousand')
+ assert approx (10**6) == (Decimal ('1'), 'million')
+ assert approx (10**9) == (Decimal ('1'), 'billion')
+ assert approx (10**12) == (Decimal ('1000'), 'billion')
+
+