Information Technology Reference
In-Depth Information
search for expressions identical to this, or we can perform a general search for
code clones in the existing file (or indeed in a complete project). Currently under
development is a facility to search for ”similar” code.
Using this approach we automatically find that test cases create 2, create 3
and create 4 only differ in an atom and a record definition. The test cases create 2
and create 3 are for audio, the test case create 4 is for video.
create_2(id) -> "create_2";
create_2(doc) -> "Create basic VIG MUX + audio LC AMR segment";
create_2(setupimg) -> "";
create_2(fts) ->
"/vobs/mgwblade/HCF/HCF_CRA1190072/test/doc/15241/XYZ_FTS.fm";
create_2(class) -> auto;
create_2(time) -> {{00,00,00},{00,00,00}};
create_2(config) -> [];
create_2(main) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
?COMMENT("Test case create_2 started.",[]),
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SidMux = {mux_id_1, h223_id_1},
{TdmSid, LocalData, _, _} = precond_one_blade_tdm_mux_create(SidMux),
?CHECK(ok, hcfTraceServerSupport, start, [[{brchDspRhI, exported}]]),
SidLc = {mux_id_1, audio_id_1},
CreateData = #brchMuxLcAccess{sid = SidLc,
stream_type = ?BRCH_AUDIO,
local_data = LocalData,
codec = {?AMR,
{?R_122, ?BRCH_DISABLED,
?BRCH_DISABLED, ?BRCH_BIT},
33, 44, 40},
event_module = iptermCb},
[{ok, [{SidLc, _IntCep}], ?BRCH_REPLICATION_NEEDED}] =
?CH(1, brchShI, create, [[CreateData]]),
?CHECK([], hcfTraceServerSupport, get_trace_list, []),
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Clean up this test case
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clean_up([SidLc, SidMux, TdmSid]),
?RESULT("DONE", []).
If we select the body of the create 2(main) clause and search for expressions (i.e.,
similar code), we will find create 4, but also a create 3, which is also for audio,
but which differs much less. We found out that generalizing code further apart
from each other will result in being able to automatically include code closer to
the original copy.
Using the facilities in Wrangler to generate this, we automatically get the
most general antiunifier of the code, that is, variables replace subterms that are
different. The most general part is copied into a new function create 234, since
it combines the 3 test cases create 2, create 3 and create 4.
Search WWH ::




Custom Search