Sha256: 0ef74ba691f1ba8a12dbf95395b14ceda83ed7c1288a35ca7a11a43db2e990dc

Contents?: true

Size: 1.21 KB

Versions: 116

Compression:

Stored size: 1.21 KB

Contents

-module('tgen_hamming').

-behaviour(tgen).

-export([
    available/0,
    version/0,
    generate_test/1
]).

-spec available() -> true.
available() ->
    true.

version() -> 2.

generate_test(#{description := Desc, expected := #{error := Message}, property := Prop, 'strand1' := S1, 'strand2' := S2}) ->
    TestName = tgen:to_test_name(Desc),
    Property = binary_to_list(Prop),
    Reason = binary_to_list(Message),

    Fn = tgs:simple_fun(TestName, [
        tgs:call_macro("assertMatch", [
            tgs:value({error, Reason}),
            tgs:call_fun("hamming:" ++ Property, [
                tgs:value(binary_to_list(S1)),
                tgs:value(binary_to_list(S2))])])]),

    {ok, Fn, [{Property, ["Strand1", "Strand2"]}]};
generate_test(#{description := Desc, expected := Exp, property := Prop, 'strand1' := S1, 'strand2' := S2}) ->
    TestName = tgen:to_test_name(Desc),
    Property = binary_to_list(Prop),

    Fn = tgs:simple_fun(TestName, [
        tgs:call_macro("assertMatch", [
            tgs:value(Exp),
            tgs:call_fun("hamming:" ++ Property, [
                tgs:value(binary_to_list(S1)),
                tgs:value(binary_to_list(S2))])])]),

    {ok, Fn, [{Property, ["Strand1", "Strand2"]}]}.

Version data entries

116 entries across 116 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.179 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.178 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.177 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.176 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.175 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.174 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.173 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.172 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.171 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.170 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.169 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.167 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.166 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.165 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.164 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.163 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.162 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.161 tracks/erlang/testgen/src/tgen_hamming.erl
trackler-2.2.1.160 tracks/erlang/testgen/src/tgen_hamming.erl