From 9b83b8365b01e97e865f1552a11bb52e94e0ad5e Mon Sep 17 00:00:00 2001 From: Justus Kuhlmann Date: Mon, 1 Dec 2025 12:06:05 +0100 Subject: [PATCH] add very simple tests for tool functions --- tests/tools_test.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/tools_test.py diff --git a/tests/tools_test.py b/tests/tools_test.py new file mode 100644 index 0000000..71c5267 --- /dev/null +++ b/tests/tools_test.py @@ -0,0 +1,25 @@ + + +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) + + +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 + + +def test_str2list(): + assert tl.str2list("a,b,c") == ["a", "b", "c"] + assert tl.str2list("1,2,3") == ["1", "2", "3"] + + +def test_list2str(): + assert tl.list2str(["a", "b", "c"]) == "a,b,c" + assert tl.list2str(["1", "2", "3"]) == "1,2,3"