fix calculation for delete function (we needed to fix the calculation of how much to decrement by)

This commit is contained in:
2025-12-09 13:10:23 +00:00
parent 7a5aca7bf2
commit 2f2d530dae
2 changed files with 25 additions and 9 deletions

View File

@@ -50,6 +50,23 @@ struct
in
Expect.isTrue (outputList = expectedList)
end)
, test
"deletes second-last value correctly \
\and adjusts last value as expected"
(fn _ =>
let
(* arrange *)
val pv = Pv.fromList [(0, 0), (3, 3), (5, 5), (7, 7)]
(* act *)
val pv = Pv.delete (4, 1, pv)
(* assert *)
val outputList = Pv.toList pv
val expectedList = [(0, 0), (3, 3), (6, 6)]
in
Expect.isTrue (outputList = expectedList)
end)
, test
"deletes middle value correctly \
\and adjusts values-after-middle as well"