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

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
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

Other popular topics Top

vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
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
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
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

We're in Beta

About us Mission Statement