add a test for 'PersistentVector.delete' (even though the 'PersistentVector.merge' helper function is unimplemented)
This commit is contained in:
@@ -284,5 +284,39 @@ struct
|
||||
end)
|
||||
]
|
||||
|
||||
val tests = [appendTests, toListTests, splitLeftTests]
|
||||
val deleteTests = describe "PersistentVector.delete"
|
||||
[test
|
||||
"returns the left side of the vector \
|
||||
\when 'finish' is greater than any element in the vector"
|
||||
(fn _ =>
|
||||
let
|
||||
(* arrange *)
|
||||
val inputList =
|
||||
[ {start = 1, finish = 1}
|
||||
, {start = 2, finish = 2}
|
||||
, {start = 3, finish = 3}
|
||||
, {start = 4, finish = 4}
|
||||
, {start = 5, finish = 5}
|
||||
, {start = 6, finish = 6}
|
||||
, {start = 7, finish = 7}
|
||||
, {start = 8, finish = 8}
|
||||
]
|
||||
val pv = PersistentVector.fromList inputList
|
||||
|
||||
(* act *)
|
||||
val pv = PersistentVector.delete (5, 9, pv)
|
||||
|
||||
(* assert *)
|
||||
val outputList = PersistentVector.toList pv
|
||||
val expectedOutput =
|
||||
[ {start = 1, finish = 1}
|
||||
, {start = 2, finish = 2}
|
||||
, {start = 3, finish = 3}
|
||||
, {start = 4, finish = 4}
|
||||
]
|
||||
in
|
||||
Expect.isTrue (outputList = expectedOutput)
|
||||
end)]
|
||||
|
||||
val tests = [appendTests, toListTests, splitLeftTests, deleteTests]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user