Kaweeda

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

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.

Where Next?

Popular in Questions Top

baxterw3b
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
ashish173
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
Darmani72
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
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
jason.o
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 Top

electic
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
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54260 488
New
baxterw3b
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
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
joeerl
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
jason.o
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

We're in Beta

About us Mission Statement