diff options
author | Joris | 2020-06-06 10:09:27 +0200 |
---|---|---|
committer | Joris | 2020-06-06 10:09:27 +0200 |
commit | 6b9195000eb5404c247288b384d7ca2bacc1ab23 (patch) | |
tree | d36d669b70d2a5f2789335e814489cd641fbae3e /src/util/test_array.py | |
parent | b244640288648f27ce1fc7be3f175703e0a3412b (diff) |
Add unit tests
Diffstat (limited to 'src/util/test_array.py')
-rw-r--r-- | src/util/test_array.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/test_array.py b/src/util/test_array.py new file mode 100644 index 0000000..38759b9 --- /dev/null +++ b/src/util/test_array.py @@ -0,0 +1,12 @@ +from array import insert_position + +def test_insert_position(): + assert insert_position(0, [], False) == 0 + assert insert_position(1, [1, 2, 3], False) == 0 + assert insert_position(2, [1, 2, 3], False) == 1 + assert insert_position(3, [1, 2, 3], False) == 2 + assert insert_position(8, [1, 2, 3], False) == 3 + assert insert_position(8, [3, 2, 1], True) == 0 + assert insert_position(3, [3, 2, 1], True) == 0 + assert insert_position(2, [3, 2, 1], True) == 1 + assert insert_position(1, [3, 2, 1], True) == 2 |