From 3f9f918c93a92350c76a761af85abf003737fc30 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sat, 29 Feb 2020 09:24:00 +0100 Subject: Fix function approx and its testcase Function was moved and changed by commit 0f8643954fd9507aec85bab46046e71a497bfffe, but the testcase was not. --- lulua/test_report.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lulua/test_report.py (limited to 'lulua/test_report.py') 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') + + -- cgit v1.2.3