Skip to content

Commit

Permalink
add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed Apr 24, 2024
1 parent 7fb2a80 commit adad87a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/test_vision_agent.py
Original file line number Diff line number Diff line change
@@ -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]

0 comments on commit adad87a

Please sign in to comment.