Coverage Tests
Add nonsense tests for nonsense coverage on standard methods. Look at CDB search_hash_table - looks like it doubled-up on break-outs so that one would never get hit
This commit is contained in:
parent
b43ec0de7e
commit
8b8652e2d7
2 changed files with 22 additions and 4 deletions
|
@ -1098,9 +1098,9 @@ search_hash_table(Handle, [Entry|RestOfEntries], Hash, Key, QuickCheck) ->
|
||||||
_ ->
|
_ ->
|
||||||
KV
|
KV
|
||||||
end;
|
end;
|
||||||
0 ->
|
%0 ->
|
||||||
% Hash is 0 so key must be missing as 0 found before Hash matched
|
% % Hash is 0 so key must be missing as 0 found before Hash matched
|
||||||
missing;
|
% missing;
|
||||||
_ ->
|
_ ->
|
||||||
search_hash_table(Handle, RestOfEntries, Hash, Key, QuickCheck)
|
search_hash_table(Handle, RestOfEntries, Hash, Key, QuickCheck)
|
||||||
end.
|
end.
|
||||||
|
@ -1841,4 +1841,15 @@ corrupt_testfile_at_offset(Offset) ->
|
||||||
?assertMatch({"Key100", "Value100"}, cdb_get(P2, "Key100")),
|
?assertMatch({"Key100", "Value100"}, cdb_get(P2, "Key100")),
|
||||||
ok = cdb_close(P2).
|
ok = cdb_close(P2).
|
||||||
|
|
||||||
|
nonsense_coverage_test() ->
|
||||||
|
{ok, Pid} = gen_fsm:start(?MODULE, [#cdb_options{}], []),
|
||||||
|
ok = gen_fsm:send_all_state_event(Pid, nonsense),
|
||||||
|
?assertMatch({next_state, reader, #state{}}, handle_info(nonsense,
|
||||||
|
reader,
|
||||||
|
#state{})),
|
||||||
|
?assertMatch({ok, reader, #state{}}, code_change(nonsense,
|
||||||
|
reader,
|
||||||
|
#state{},
|
||||||
|
nonsense)).
|
||||||
|
|
||||||
-endif.
|
-endif.
|
||||||
|
|
|
@ -2026,6 +2026,13 @@ filename_test() ->
|
||||||
nonsense_coverage_test() ->
|
nonsense_coverage_test() ->
|
||||||
{ok, Pid} = gen_fsm:start(?MODULE, [], []),
|
{ok, Pid} = gen_fsm:start(?MODULE, [], []),
|
||||||
undefined = gen_fsm:sync_send_all_state_event(Pid, nonsense),
|
undefined = gen_fsm:sync_send_all_state_event(Pid, nonsense),
|
||||||
ok = gen_fsm:send_all_state_event(Pid, nonsense).
|
ok = gen_fsm:send_all_state_event(Pid, nonsense),
|
||||||
|
?assertMatch({next_state, reader, #state{}}, handle_info(nonsense,
|
||||||
|
reader,
|
||||||
|
#state{})),
|
||||||
|
?assertMatch({ok, reader, #state{}}, code_change(nonsense,
|
||||||
|
reader,
|
||||||
|
#state{},
|
||||||
|
nonsense)).
|
||||||
|
|
||||||
-endif.
|
-endif.
|
Loading…
Add table
Add a link
Reference in a new issue