Skip to content

Commit 6e05a56

Browse files
committed
hamming: Updated the exercise to the 2.2.0 version
Relevant PR: - exercism/problem-specifications#1412
1 parent 1c2b982 commit 6e05a56

File tree

2 files changed

+21
-77
lines changed

2 files changed

+21
-77
lines changed

exercises/hamming/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[package]
22
name = "hamming"
3-
version = "2.1.1"
3+
version = "2.2.0"

exercises/hamming/tests/hamming.rs

Lines changed: 20 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,16 @@ fn test_empty_strands() {
1414

1515
#[test]
1616
#[ignore]
17-
fn test_no_difference_between_identical_strands() {
18-
process_distance_case(["GGACTGA", "GGACTGA"], Some(0));
19-
}
20-
21-
#[test]
22-
#[ignore]
23-
fn test_complete_hamming_distance_in_small_strand() {
24-
process_distance_case(["ACT", "GGA"], Some(3));
25-
}
26-
27-
#[test]
28-
#[ignore]
29-
fn test_small_hamming_distance_in_the_middle_somewhere() {
30-
process_distance_case(["GGACG", "GGTCG"], Some(1));
17+
/// disallow first strand longer
18+
fn test_disallow_first_strand_longer() {
19+
process_distance_case(["AATG", "AAA"], None);
3120
}
3221

3322
#[test]
3423
#[ignore]
35-
fn test_larger_distance() {
36-
process_distance_case(["ACCAGGG", "ACTATGG"], Some(2));
24+
/// disallow second strand longer
25+
fn test_disallow_second_strand_longer() {
26+
process_distance_case(["ATA", "AGTG"], None);
3727
}
3828

3929
#[test]
@@ -50,98 +40,52 @@ fn test_second_string_is_longer() {
5040

5141
#[test]
5242
#[ignore]
53-
/// non-unique character in first strand
54-
fn test_nonunique_character_in_first_strand() {
55-
process_distance_case(["AAG", "AAA"], Some(1));
56-
}
57-
58-
#[test]
59-
#[ignore]
60-
/// identical strands
61-
fn test_identical_strands() {
43+
/// single letter identical strands
44+
fn test_single_letter_identical_strands() {
6245
process_distance_case(["A", "A"], Some(0));
6346
}
6447

6548
#[test]
6649
#[ignore]
67-
/// complete distance in small strands
68-
fn test_complete_distance_in_small_strands() {
69-
process_distance_case(["AG", "CT"], Some(2));
70-
}
71-
72-
#[test]
73-
#[ignore]
74-
/// disallow first strand longer
75-
fn test_disallow_first_strand_longer() {
76-
process_distance_case(["AATG", "AAA"], None);
77-
}
78-
79-
#[test]
80-
#[ignore]
81-
/// large distance
82-
fn test_large_distance() {
83-
process_distance_case(["GATACA", "GCATAA"], Some(4));
50+
/// small distance
51+
fn test_single_letter_different_strands() {
52+
process_distance_case(["G", "T"], Some(1));
8453
}
8554

8655
#[test]
8756
#[ignore]
8857
/// long identical strands
8958
fn test_long_identical_strands() {
90-
process_distance_case(["GGACTGA", "GGACTGA"], Some(0));
59+
process_distance_case(["GGACTGAAATCTG", "GGACTGAAATCTG"], Some(0));
9160
}
9261

9362
#[test]
9463
#[ignore]
95-
/// complete distance in single nucleotide strands
96-
fn test_complete_distance_in_single_nucleotide_strands() {
97-
process_distance_case(["A", "G"], Some(1));
64+
fn test_no_difference_between_identical_strands() {
65+
process_distance_case(["GGACTGA", "GGACTGA"], Some(0));
9866
}
9967

10068
#[test]
10169
#[ignore]
102-
/// small distance
103-
fn test_small_distance() {
104-
process_distance_case(["GGACG", "GGTCG"], Some(1));
70+
fn test_complete_hamming_distance_in_small_strand() {
71+
process_distance_case(["ACT", "GGA"], Some(3));
10572
}
10673

10774
#[test]
10875
#[ignore]
109-
/// non-unique character in second strand
110-
fn test_nonunique_character_in_second_strand() {
111-
process_distance_case(["AAA", "AAG"], Some(1));
76+
fn test_small_hamming_distance_in_the_middle_somewhere() {
77+
process_distance_case(["GGACG", "GGTCG"], Some(1));
11278
}
11379

11480
#[test]
11581
#[ignore]
116-
/// small distance in long strands
117-
fn test_small_distance_in_long_strands() {
82+
fn test_larger_distance() {
11883
process_distance_case(["ACCAGGG", "ACTATGG"], Some(2));
11984
}
12085

121-
#[test]
122-
#[ignore]
123-
/// disallow second strand longer
124-
fn test_disallow_second_strand_longer() {
125-
process_distance_case(["ATA", "AGTG"], None);
126-
}
127-
128-
#[test]
129-
#[ignore]
130-
/// small distance in small strands
131-
fn test_small_distance_in_small_strands() {
132-
process_distance_case(["AT", "CT"], Some(1));
133-
}
134-
13586
#[test]
13687
#[ignore]
13788
/// large distance in off-by-one strand
138-
fn test_large_distance_in_offbyone_strand() {
89+
fn test_long_different_strands() {
13990
process_distance_case(["GGACGGATTCTG", "AGGACGGATTCT"], Some(9));
14091
}
141-
142-
#[test]
143-
#[ignore]
144-
/// same nucleotides in different positions
145-
fn test_same_nucleotides_in_different_positions() {
146-
process_distance_case(["TAG", "GAT"], Some(2));
147-
}

0 commit comments

Comments
 (0)