Skip to content

Commit

Permalink
Add more properties to Seq
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Bärenz committed Jun 9, 2021
1 parent b7ba95b commit 073ff2c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/hallux/seq_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,37 @@ defmodule Hallux.SeqTest do
assert Valid.valid?(seq)
end
end

property "cons . view_l = id" do
check all(
s <- seq(),
item <- term()
) do
{item_, s_} = Seq.view_l(Seq.cons(s, item))
assert_equal(s, s_)
assert item == item_
end
end
end

property "snoc . view_r = id" do
check all(
s <- seq(),
item <- term()
) do
{s_, item_} = Seq.view_r(Seq.snoc(s, item))
assert_equal(s, s_)
assert item == item_
end
end

property "concat . to_list = to_list . ++" do
check all(
s1 <- seq(),
s2 <- seq()
) do
assert Enum.to_list(Seq.concat(s1, s2)) == Enum.to_list(s1) ++ Enum.to_list(s2)
end
end

defp assert_equal(s1 = %Seq{}, s2 = %Seq{}) do
Expand Down

0 comments on commit 073ff2c

Please sign in to comment.