|
6 | 6 | #include "test/catch.hpp" |
7 | 7 | #endif |
8 | 8 |
|
9 | | -TEST_CASE("no_difference_between_identical_strands") |
| 9 | +TEST_CASE("single letter identical strands", "[hamming][54681314-eee2-439a-9db0-b0636c656156]") |
10 | 10 | { |
11 | 11 | REQUIRE(0 == hamming::compute("A", "A")); |
12 | 12 | } |
13 | 13 |
|
14 | 14 | #if defined(EXERCISM_RUN_ALL_TESTS) |
15 | | -TEST_CASE("complete_hamming_distance_for_single_nucleotide_strand") |
| 15 | +TEST_CASE("empty strands", "[hamming][f6dcb64f-03b0-4b60-81b1-3c9dbf47e887]") |
16 | 16 | { |
17 | | - REQUIRE(1 == hamming::compute("A", "G")); |
| 17 | + REQUIRE(0 == hamming::compute("", "")); |
18 | 18 | } |
19 | 19 |
|
20 | | -TEST_CASE("complete_hamming_distance_for_small_strand") |
| 20 | +TEST_CASE("single letter different strands", "[hamming][294479a3-a4c8-478f-8d63-6209815a827b]") |
21 | 21 | { |
22 | | - REQUIRE(2 == hamming::compute("AG", "CT")); |
| 22 | + REQUIRE(1 == hamming::compute("G", "T")); |
23 | 23 | } |
24 | 24 |
|
25 | | -TEST_CASE("small_hamming_distance") |
| 25 | +TEST_CASE("long identical strands", "[hamming][9aed5f34-5693-4344-9b31-40c692fb5592]") |
26 | 26 | { |
27 | | - REQUIRE(1 == hamming::compute("AT", "CT")); |
| 27 | + REQUIRE(0 == hamming::compute("GGACTGAAATCTG", "GGACTGAAATCTG")); |
28 | 28 | } |
29 | 29 |
|
30 | | -TEST_CASE("small_hamming_distance_in_longer_strand") |
| 30 | +TEST_CASE("long different strands", "[hamming][cd2273a5-c576-46c8-a52b-dee251c3e6e5]") |
31 | 31 | { |
32 | | - REQUIRE(1 == hamming::compute("GGACG", "GGTCG")); |
| 32 | + REQUIRE(9 == hamming::compute("GGACGGATTCTG", "AGGACGGATTCT")); |
33 | 33 | } |
34 | 34 |
|
35 | | -TEST_CASE("domain_error_when_first_string_is_longer") |
| 35 | +TEST_CASE("disallow first strand longer", "[hamming][b9228bb1-465f-4141-b40f-1f99812de5a8]") |
36 | 36 | { |
37 | | - REQUIRE_THROWS_AS(hamming::compute("AAAG", "AAA"), std::domain_error); |
| 37 | + REQUIRE_THROWS_AS(hamming::compute("AATG", "AAA"), std::domain_error); |
38 | 38 | } |
39 | 39 |
|
40 | | -TEST_CASE("domain_error_when_second_string_is_longer") |
| 40 | +TEST_CASE("disallow second strand longer", "[hamming][dab38838-26bb-4fff-acbe-3b0a9bfeba2d]") |
41 | 41 | { |
42 | | - REQUIRE_THROWS_AS(hamming::compute("AAA", "AAAG"), std::domain_error); |
| 42 | + REQUIRE_THROWS_AS(hamming::compute("ATA", "AGTG"), std::domain_error); |
43 | 43 | } |
44 | 44 |
|
45 | | -TEST_CASE("large_hamming_distance") |
| 45 | +TEST_CASE("disallow empty first strand", "[hamming][b764d47c-83ff-4de2-ab10-6cfe4b15c0f3]") |
46 | 46 | { |
47 | | - REQUIRE(4 == hamming::compute("GATACA", "GCATAA")); |
| 47 | + REQUIRE_THROWS_AS(hamming::compute("", "G"), std::domain_error); |
48 | 48 | } |
49 | 49 |
|
50 | | -TEST_CASE("hamming_distance_in_very_long_strand") |
| 50 | +TEST_CASE("disallow empty second strand", "[hamming][9ab9262f-3521-4191-81f5-0ed184a5aa89]") |
51 | 51 | { |
52 | | - REQUIRE(9 == hamming::compute("GGACGGATTCTG", "AGGACGGATTCT")); |
| 52 | + REQUIRE_THROWS_AS(hamming::compute("G", ""), std::domain_error); |
53 | 53 | } |
54 | 54 | #endif |
0 commit comments