-
Notifications
You must be signed in to change notification settings - Fork 8
/
proper_test.exs
47 lines (35 loc) · 976 Bytes
/
proper_test.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
defmodule Proper.Test do
use ExUnit.Case
test "module" do
assert is_list(Proper.module(Proper.TestModule))
end
test "quickcheck" do
assert Proper.quickcheck(property)
end
test "run" do
{_, failures} = Proper.run(__MODULE__)
assert length(failures) == 0
end
defp property do
use Proper.Properties
forall x in integer, do: is_integer(x)
end
end
defmodule Proper.TestModule do
use Proper.Properties
property simple_forall do
forall x in integer, do: is_integer(x)
end
property :failing_forall do
forall x in integer, do: x > 0
end
property "let" do
forall x in (let x = pos_integer, do: -x), do: x < 0
end
property "suchthat" do
forall x in (let x = integer, when: x > 0), do: x > 0
end
property "suchthatmaybe" do
forall x in (let x = pos_integer, strict: false, when: x < 0), do: x > 0
end
end