aboutsummaryrefslogtreecommitdiff
path: root/todo/util/test_array.py
diff options
context:
space:
mode:
Diffstat (limited to 'todo/util/test_array.py')
-rw-r--r--todo/util/test_array.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/todo/util/test_array.py b/todo/util/test_array.py
new file mode 100644
index 0000000..0186403
--- /dev/null
+++ b/todo/util/test_array.py
@@ -0,0 +1,12 @@
+from todo.util.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