No case clause matching when property testing

property "when a & b are arbitrary json objects; patch(a, diff(a,b)) == b" do
    check all(
            map_a <- map_of(boolean(), boolean()),
            map_b <- nonempty(map_of(boolean(), boolean()))
          ) do




      assert d = JsonDiffEx.diff(map_a,map_b)
      assert map_b = JsonDiffEx.patch(map_a, d)

(ExUnitProperties.Error) failed with generated values (after 1 successful run):

     * Clause:    map_a <- map_of(boolean(), boolean())
       Generated: %{true: false}
     
     * Clause:    map_b <- nonempty(map_of(boolean(), boolean()))
       Generated: %{false: false}
 
 got exception:
 
     ** (CaseClauseError) no case clause matching: [false, 0, 0]

Not sure what the problem is, i’m trying to check "when a & b are arbitrary json objects; patch(a, diff(a,b)) == b. New to elixir and property testing so thank you for the patience and help. Need to write a property test to check that this library works and not sure how to do it.

What version of JsonDiffEx are you using? Using the latest version from Github, those operations appear to work:

iex(6)> JsonDiffEx.diff %{true => false}, %{false => true}
%{false: [true], true: [false, 0, 0]}

iex(7)> JsonDiffEx.patch %{true => false}, v(6)
%{false: true}

A side question: is a map with boolean keys even valid JSON?

I have the latest version installed. Where the problem I think is the stream data. I am writing a property test to show that the JsonDiffEx library works on two json’s and it does but I am not sure how to generate the data to run for the property tests ( I am an intern)

check all(
            map_a <- map_of(boolean(), boolean()),
            map_b <- nonempty(map_of(boolean(), boolean()))
          ) do

It would be helpful to see the rest of the error message after:

 got exception:
 
     ** (CaseClauseError) no case clause matching: [false, 0, 0]

to see where the crash is happening.

stacktrace:
(json_diff_ex 0.5.3) lib/json_diff_ex.ex:252: anonymous fn/3 in JsonDiffEx.do_patch/2
(elixir 1.13.2) lib/map.ex:617: Map.update/4
(stdlib 3.17) maps.erl:410: :maps.fold_1/3
(json_diff_ex 0.5.3) lib/json_diff_ex.ex:251: JsonDiffEx.do_patch/2
hidden1/hidden2/hidden3/difftesting_test.exs:17: anonymous fn/3 in DifftestingTest.“property when a & b are arbitrary json objects; patch(a, diff(a,b)) == b”/1
(stream_data 0.5.0) lib/stream_data.ex:2148: StreamData.shrink_failure/6
(stream_data 0.5.0) lib/stream_data.ex:2108: StreamData.check_all/7
test/hidden1/hidden/difftesting_test.exs:8: (test)

Wherever it says hidden, is just internal libraries i’m not allowed to show

But is this helpful?

This is not the latest version of json_diff_ex - 0.5.3 was released in September 2016!

In particular, the line in that version that’s crashing is this case:

which was changed to match on [_, 0, 0] in that last clause in this PR included in version 0.6.5

Thank you so much.