Skip to content

Commit

Permalink
removes an unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderDennis committed Jan 26, 2024
1 parent ad450b7 commit 143c8d9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
4 changes: 0 additions & 4 deletions lib/decorum.ex
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,6 @@ defmodule Decorum do
end)
end

def uniform_integer do
uniform_integer(Integer.pow(2, 32) - 1)
end

## Helpers

@doc """
Expand Down
16 changes: 11 additions & 5 deletions lib/decorum/history.ex
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,17 @@ defmodule Decorum.History do
def sort_chunk(history, chunk) do
{pre, chunk_elements, post} = get_chunked_parts(history, chunk)

Enum.concat([
pre,
Enum.sort(chunk_elements),
post
])
sorted = Enum.sort(chunk_elements)

if sorted != chunk_elements do
Enum.concat([
pre,
sorted,
post
])
else
history
end
end

@spec get_chunk_elements(t(), Chunk.t()) :: t()
Expand Down
14 changes: 8 additions & 6 deletions lib/decorum/shrinker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,16 @@ defmodule Decorum.Shrinker do
defp shrink_by_chunks(check_function, generator, history) do
history_length = Enum.count(history)

chunks = min(history_length, 4)..1
|> Enum.flat_map(fn chunk_length ->
Chunk.chunks(history_length, chunk_length)
end)
chunks =
min(history_length, 4)..1
|> Enum.flat_map(fn chunk_length ->
Chunk.chunks(history_length, chunk_length)
end)

Stream.concat([
Stream.map(chunks, &(History.delete_chunk(history, &1))),
Stream.map(chunks, &(History.replace_chunk_with_zero(history, &1)))
Stream.map(chunks, &History.delete_chunk(history, &1)),
Stream.map(chunks, &History.replace_chunk_with_zero(history, &1))
# Stream.map(chunks, &History.sort_chunk(history, &1))
])
|> Enum.filter(&(&1 != history))
|> Enum.map(&check_history(&1, generator, check_function))
Expand Down

0 comments on commit 143c8d9

Please sign in to comment.