Skip to content

Commit

Permalink
adding missed custom contain return and hash function
Browse files Browse the repository at this point in the history
  • Loading branch information
mpope9 committed Dec 26, 2019
1 parent 20fdf7d commit 5c22b42
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/exor_filter_test.erl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ basic_test_() ->
?_test(xor8_hash_does_not_return_uint64()),
?_test(xor8_hash_does_not_return_uint64_buffered()),
?_test(xor8_custom_contain_return()),
?_test(xor8_contain_hash_function_custom_return()),
?_test(xor8_contain_key_not_uint64()),
?_test(xor8_contain_custom_key_not_uint64()),
?_test(xor8_valid_filter_in_contain()),
Expand Down Expand Up @@ -56,6 +57,7 @@ basic_test_() ->
?_test(xor16_hash_does_not_return_uint64()),
?_test(xor16_hash_does_not_return_uint64_buffered()),
?_test(xor16_custom_contain_return()),
?_test(xor16_contain_hash_function_custom_return()),
?_test(xor16_contain_key_not_uint64()),
?_test(xor16_contain_custom_key_not_uint64()),
?_test(xor16_valid_filter_in_contain()),
Expand Down Expand Up @@ -152,6 +154,14 @@ xor8_custom_contain_return() ->
?_assertMatch(asdf, exor_filter:xor8_contain(Filter, 6, asdf)),
exor_filter:xor8_free(Filter).

xor8_contain_hash_function_custom_return() ->
Fun = fun(X) -> X + 1 end,
Filter = exor_filter:xor8([1, 2, 3], Fun),
?_assertMatch(true, exor_filter:xor8_contain(Filter, 2)),
?_assertMatch({error, reason},
exor_filter:xor8_contain(Filter, 1, {error, reason})),
exor_filter:xor8_free(Filter).

xor8_contain_key_not_uint64() ->
Filter = exor_filter:xor8([1, 2, 3], none),
?_assertMatch({error, get_key_for_contains_error},
Expand Down Expand Up @@ -289,6 +299,14 @@ xor16_custom_contain_return() ->
?_assertMatch(asdf, exor_filter:xor16_contain(Filter, 6, asdf)),
exor_filter:xor16_free(Filter).

xor16_contain_hash_function_custom_return() ->
Fun = fun(X) -> X + 1 end,
Filter = exor_filter:xor16([1, 2, 3], Fun),
?_assertMatch(true, exor_filter:xor16_contain(Filter, 2)),
?_assertMatch({error, reason},
exor_filter:xor16_contain(Filter, 1, {error, reason})),
exor_filter:xor16_free(Filter).

xor16_contain_key_not_uint64() ->
Filter = exor_filter:xor16([1, 2, 3], none),
?_assertMatch({error, get_key_for_contains_error},
Expand Down

0 comments on commit 5c22b42

Please sign in to comment.