basho / riak_dt

Convergent replicated datatypes in Erlang
Apache License 2.0
353 stars 70 forks source link

The test for `invalid_binary` may sometimes fail #112

Open russelldb opened 9 years ago

russelldb commented 9 years ago

If by chance the call to crypto:rand_bytes generates a random bitstring that starts with a data types tag (in the example below a bitstring that starts with the map ?TAG has been generated) then the test will fail for the wrong reason. Use quickcheck, or some deterministic method to generate bytes that are invalid from the start.

riak_dt_map: invalid_binary_test...*failed*
in function riak_dt_map:'-invalid_binary_test/0-fun-0-'/0 (src/riak_dt_map.erl, line 955)
**error:{assertMatch_failed,[{module,riak_dt_map},
                 {line,955},
                 {expression,"from_binary ( << ( crypto : rand_bytes ( 187 ) ) / binary >> )"},
                 {pattern,"? INVALID_BINARY"},
                 {value,{error,unsupported_version,226}}]}