From adad87a5c89e0fafd562c5d51bc975021fe9e344 Mon Sep 17 00:00:00 2001 From: Dillon Laird Date: Wed, 24 Apr 2024 16:25:21 -0700 Subject: [PATCH] add test cases --- tests/test_vision_agent.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/test_vision_agent.py diff --git a/tests/test_vision_agent.py b/tests/test_vision_agent.py new file mode 100644 index 00000000..78da24e6 --- /dev/null +++ b/tests/test_vision_agent.py @@ -0,0 +1,31 @@ +from vision_agent.agent.vision_agent import sample_n_evenly_spaced + + +def test_sample_n_evenly_spaced_side_cases(): + # Test for empty input + assert sample_n_evenly_spaced([], 0) == [] + assert sample_n_evenly_spaced([], 1) == [] + + # Test for n = 0 + assert sample_n_evenly_spaced([1, 2, 3, 4], 0) == [] + + # Test for n = 1 + assert sample_n_evenly_spaced([1, 2, 3, 4], -1) == [] + assert sample_n_evenly_spaced([1, 2, 3, 4], 5) == [1, 2, 3, 4] + + +def test_sample_n_evenly_spaced_even_cases(): + assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6], 2) == [1, 4] + assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6], 3) == [1, 3, 5] + assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6], 4) == [1, 2, 3, 4] + assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6], 5) == [1, 2, 3, 4, 5] + assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6], 6) == [1, 2, 3, 4, 5, 6] + + +def test_sample_n_evenly_spaced_odd_cases(): + assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6, 7], 2) == [1, 5] + assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6, 7], 3) == [1, 4, 7] + assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6, 7], 4) == [1, 3, 5, 7] + assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6, 7], 5) == [1, 2, 3, 5, 7] + assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6, 7], 6) == [1, 2, 3, 4, 5, 7] + assert sample_n_evenly_spaced([1, 2, 3, 4, 5, 6, 7], 7) == [1, 2, 3, 4, 5, 6, 7]