20 lines
496 B
Python
20 lines
496 B
Python
import sys, os
|
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")))
|
|
from comparator.rounding_detect import detect_rounding
|
|
|
|
|
|
def test_truncation():
|
|
r = detect_rounding("1500000", "1499999")
|
|
assert r.mode in ("TRUNCATE", "HALF_UP")
|
|
|
|
|
|
def test_exact():
|
|
r = detect_rounding("1500000", "1500000")
|
|
assert r.mode == "EXACT"
|
|
assert r.confidence == 1.0
|
|
|
|
|
|
def test_small_diff():
|
|
r = detect_rounding("1500", "1498")
|
|
assert r.confidence < 1.0
|