Kaweeda
Streamdata: how to set size for generated data
Hi all, I am running property tests and was wondering how to set the size of the data generated. For example in JS you can do this :
describe("when a & b are arbitrary json objects; patch(a, diff(a,b)) == b", function () {
it("holds for lots of small objects", function () {
jsc.assert(property, { tests: 100, size: 50, quiet: false });
});
Which would be running 100 tests and the data generated would be of size 50. I have this right now:
property "when a & b are arbitrary json objects; patch(a, diff(a,b)) == b" do
check all(
map_a <- map_of(one_of([string(:printable), atom(:alphanumeric)]), term()),
map_b <- map_of(one_of([string(:printable), atom(:alphanumeric)]), term()),
max_runs: 100,
initial_size: 1,
max_generation_size: 50
) do
assert map_b == JsonDiffEx.patch(map_a,JsonDiffEx.diff(map_a, map_b))
Is this working the same way ? If not, what should be done? Thank you in advance, and patience with me.
First Post!
dimitarvp
Not completely sure if that’s what you’re asking but stream_data has a section on generation size here: StreamData — StreamData v1.3.0. It also contains links to two other functions that can help you.
0
Popular in Questions
Hi guys, i’m new in the Elixir world, and i have to say, that i love it!
i’m having some problem to understand anonymous functions with ...
New
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
If I have a post route which an argument:
post /my_post_route/:my_param1, MyController.my_post_handler
How would get the post params ...
New
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
i’m a new one to elixir
which editor can i use
vs code? or atom?
Thanks! :smiley:
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
Other popular topics
Hi,
I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
Hi guys, i’m new in the Elixir world, and i have to say, that i love it!
i’m having some problem to understand anonymous functions with ...
New
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









