This repository has been archived by the owner on May 21, 2023. It is now read-only.
forked from parroty/excheck
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: such that constraints [Closes parroty#14]
- Loading branch information
1 parent
7947bec
commit 7bd65f5
Showing
2 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
defmodule ExCheck.SuchThatTest do | ||
use ExUnit.Case | ||
use ExCheck | ||
|
||
# https://github.com/parroty/excheck/issues/14 | ||
property :stj_such_that_constraints do | ||
for_all {s, t, j} in such_that({s_, t_, j_} in {int(), int(), int()} when s_ < j_ and j_ < t_) do | ||
assert j > s, inspect([s, j, t]) | ||
assert j < t, inspect([s, j, t]) | ||
end | ||
end | ||
|
||
defp gen_sjt, | ||
do: | ||
[int(), pos_integer(), pos_integer()] | ||
|> bind(fn [s, dj, dt] -> {s, s + dj, s + dj + dt} end) | ||
|
||
property :sjt_bind do | ||
for_all {s, j, t} in gen_sjt() do | ||
assert j > s, inspect([s, j, t]) | ||
assert j < t, inspect([s, j, t]) | ||
end | ||
end | ||
end |