From 574877c74494cff56aafebc7ecb72d968eb1c932 Mon Sep 17 00:00:00 2001 From: Justus Kuhlmann Date: Mon, 1 Dec 2025 18:43:47 +0100 Subject: [PATCH] add two more trivial tests --- tests/tools_test.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/tools_test.py b/tests/tools_test.py index 71c5267..ee76f1c 100644 --- a/tests/tools_test.py +++ b/tests/tools_test.py @@ -4,15 +4,21 @@ from corrlib import tools as tl def test_m2k(): - assert tl.m2k(0.1) == 1/(2*0.1+8) - assert tl.m2k(0.5) == 1/(2*0.5+8) - assert tl.m2k(1.0) == 1/(2*1.0+8) + for m in [0.1, 0.5, 1.0]: + expected_k = 1 / (2 * m + 8) + assert tl.m2k(m) == expected_k def test_k2m(): - assert tl.k2m(0.1) == (1/(2*0.1))-4 - assert tl.k2m(0.5) == (1/(2*0.5))-4 - assert tl.k2m(1.0) == (1/(2*1.0))-4 + for m in [0.1, 0.5, 1.0]: + assert tl.k2m(m) == (1/(2*m))-4 + + +def test_k2m_m2k(): + for m in [0.1, 0.5, 1.0]: + k = tl.m2k(m) + m_converted = tl.k2m(k) + assert abs(m - m_converted) < 1e-9 def test_str2list():