Skip to content

Commit

Permalink
trying shinking challenge Difference test 1
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderDennis committed Apr 6, 2024
1 parent 10819ca commit d2edede
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ Maybe flatten the structure while keeping `random/0` and `hardcoded/1` construct

- [ ] Create seperate doc sections of functions within `Decorum` module: helpers, property testing, and generators.

- [ ] Should generators be a behavior? The generate function is a good use case for a callback. Does that effect the Enumerable implementation?

### How do we make generators composible?

Users should be able to create new generators based on the library generators.
Expand Down
22 changes: 19 additions & 3 deletions test/shrinking_challenge_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,32 @@ defmodule ShrinkingChallengeTest do
end

# assert that 3 of the lists are empty
# IO.inspect(value)
assert Enum.count(value, &(&1 == [])) == 3
end

@tag :skip
test "difference 1" do
%Decorum.PropertyError{value: value} =
assert_raise Decorum.PropertyError,
fn ->
Decorum.zip(
Decorum.integer(0..1000),
Decorum.integer(0..1000)
)
|> Decorum.check_all(fn {x, y} ->
x < 10 or x != y
end)
end

assert value == [10, 10]
end

test "large union list" do
# takes over 34 seconds with seed 590589
# takes 31.8 seconds with seed 804291
%Decorum.PropertyError{value: value} =
assert_raise Decorum.PropertyError,
fn ->
Decorum.integer(-4294967296..4294967295)
Decorum.integer(-4_294_967_296..4_294_967_295)
|> Decorum.list_of()
|> Decorum.list_of()
|> Decorum.check_all(fn lists ->
Expand Down

0 comments on commit d2edede

Please sign in to comment.