Add tests for appDefined functions
This commit is contained in:
parent
706ba8a674
commit
9d92ca0773
6 changed files with 289 additions and 26 deletions
|
@ -3276,6 +3276,10 @@ sqnorder_mutatefold_test() ->
|
|||
|
||||
ok = book_destroy(Bookie1).
|
||||
|
||||
search_test() ->
|
||||
?assertMatch({value, 5}, search(fun(X) -> X == 5 end, lists:seq(1, 10))),
|
||||
?assertMatch(false, search(fun(X) -> X == 55 end, lists:seq(1, 10))).
|
||||
|
||||
check_notfound_test() ->
|
||||
ProbablyFun = fun() -> probably end,
|
||||
MissingFun = fun() -> missing end,
|
||||
|
|
|
@ -366,14 +366,12 @@ endkey_passed(EndKey, CheckingKey) ->
|
|||
%% Take the default strategy for compaction, and override the approach for any
|
||||
%% tags passed in
|
||||
inker_reload_strategy(AltList) ->
|
||||
ReloadStrategy0 =
|
||||
DefaultList =
|
||||
lists:map(fun leveled_head:default_reload_strategy/1,
|
||||
leveled_head:defined_objecttags()),
|
||||
lists:foldl(fun({X, Y}, SList) ->
|
||||
lists:keyreplace(X, 1, SList, {X, Y})
|
||||
end,
|
||||
ReloadStrategy0,
|
||||
AltList).
|
||||
lists:ukeymerge(1,
|
||||
lists:ukeysort(1, AltList),
|
||||
lists:ukeysort(1, DefaultList)).
|
||||
|
||||
|
||||
-spec get_tagstrategy(ledger_key()|tag()|dummy, compaction_strategy())
|
||||
|
|
|
@ -472,4 +472,13 @@ diff_index_test() ->
|
|||
?assertMatch([{add, <<"idx1_bin">>, <<"20840930001702Zoe">>},
|
||||
{remove, <<"idx1_bin">>,<<"20231126131808Madison">>}], IdxSpecs).
|
||||
|
||||
decode_test() ->
|
||||
Bin = <<"999">>,
|
||||
BinTerm = term_to_binary("999"),
|
||||
?assertMatch("999", binary_to_list(
|
||||
decode_maybe_binary(<<1:8/integer, Bin/binary>>))),
|
||||
?assertMatch("999", decode_maybe_binary(<<0:8/integer, BinTerm/binary>>)),
|
||||
?assertMatch("999", binary_to_list(
|
||||
decode_maybe_binary(<<2:8/integer, Bin/binary>>))).
|
||||
|
||||
-endif.
|
Loading…
Add table
Add a link
Reference in a new issue