From 44e9c3ea492f2fbb43f6235deb9ec7b6ebb6f5e1 Mon Sep 17 00:00:00 2001 From: Maximilian Friedersdorff Date: Mon, 4 Mar 2019 21:26:50 +0000 Subject: [PATCH] Add unittests for collatz conjecture --- 3_collatz.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 3_collatz.py diff --git a/3_collatz.py b/3_collatz.py new file mode 100644 index 0000000..d05c66b --- /dev/null +++ b/3_collatz.py @@ -0,0 +1,20 @@ +from collatz import collatz, longest_collatz + +def test_length_collatz_13(): + assert collatz(13) == 9 + +def test_length_collatz_9(): + assert collatz(9) == 19 + +def test_length_collatz_77031(): + assert collatz(77031) == 350 + +def test_length_collatz_8400511(): + assert collatz(8400511) == 685 + + +def test_longest_collatz_under_1_000_000(): + assert longest_collatz(1000000) == 837799 + +def test_longest_collatz_under_1_000_000_000(): + assert longest_collatz(1000000000) == 670617279 -- 2.46.2