MoreStreamData
Additional generators based on StreamData.
Installation
Add more_stream_data to your list of dependencies in mix.exs
def deps do
[
{:more_stream_data, "~> 0.6", only: :test}
]
endRefer to StreamData documentation for usage.
You can call additional generators directly in any testfile
defmodule MyTestMoule do
use ExUnit.Case
use ExUnitProperties
property "strings matching regular expression" do
regex = ~r/^[A-Z]_[a-z0-9]+$/
check all string <- MoreStreamData.from_regex(regex) do
assert Regex.match?(regex, string)
end
end
endRoadmap
The goal is to port Python's Hypothesis built-in and external strategies considered useful for Elixir ecosystem.
-
Strategies
integersfloatsexclude_minandexclude_maxoptions.
decimalemailsdomainsurlsdatetimetimetimedeltasip_addressfrom_regex-
Newline setting
(*ANYCRLF),(*NUL), etc. \bword boundaryxHHandx{HHH...}for hex characters- Atomic groups: Always matches the first option
-
Lookarounds
- Positive lookahead
- Negative lookahead
- Positive lookbehind
- Negative lookbehind
-
Modifiers
-
Case insensitive
/i -
Extended
/x -
Unicode
/u -
Dotall
/s -
Multiline
/m -
Firstline
/f -
Ungreedy
/U. Ignored since it does not affect string generation. -
Export
/E. Ignored since it does not affect string generation.
-
Case insensitive
-
Newline setting