Sha256: 23f4e8023aa9c7351816fe0826dcf95215d17e2b060032eae8294fbe7b922937

Contents?: true

Size: 1.79 KB

Versions: 116

Compression:

Stored size: 1.79 KB

Contents

-module(hamming_tests).

% This file is automatically generated from the exercises canonical data.

-include_lib("erl_exercism/include/exercism.hrl").
-include_lib("eunit/include/eunit.hrl").


empty_strands_test() ->
    ?assertMatch(0, hamming:distance([], [])).

identical_strands_test() ->
    ?assertMatch(0, hamming:distance("A", "A")).

long_identical_strands_test() ->
    ?assertMatch(0, hamming:distance("GGACTGA", "GGACTGA")).

complete_distance_in_single_nucleotide_strands_test() ->
    ?assertMatch(1, hamming:distance("A", "G")).

complete_distance_in_small_strands_test() ->
    ?assertMatch(2, hamming:distance("AG", "CT")).

small_distance_in_small_strands_test() ->
    ?assertMatch(1, hamming:distance("AT", "CT")).

small_distance_test() ->
    ?assertMatch(1, hamming:distance("GGACG", "GGTCG")).

small_distance_in_long_strands_test() ->
    ?assertMatch(2, hamming:distance("ACCAGGG", "ACTATGG")).

non_unique_character_in_first_strand_test() ->
    ?assertMatch(1, hamming:distance("AAG", "AAA")).

non_unique_character_in_second_strand_test() ->
    ?assertMatch(1, hamming:distance("AAA", "AAG")).

same_nucleotides_in_different_positions_test() ->
    ?assertMatch(2, hamming:distance("TAG", "GAT")).

large_distance_test() ->
    ?assertMatch(4, hamming:distance("GATACA", "GCATAA")).

large_distance_in_off_by_one_strand_test() ->
    ?assertMatch(9,
		 hamming:distance("GGACGGATTCTG", "AGGACGGATTCT")).

disallow_first_strand_longer_test() ->
    ?assertMatch({error,
		  "left and right strands must be of equal "
		  "length"},
		 hamming:distance("AATG", "AAA")).

disallow_second_strand_longer_test() ->
    ?assertMatch({error,
		  "left and right strands must be of equal "
		  "length"},
		 hamming:distance("ATA", "AGTG")).

version_test() ->
    ?assertMatch(2, hamming:test_version()).

Version data entries

116 entries across 116 versions & 1 rubygems

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