|
|
@@ -7,64 +7,63 @@ import org.junit.Rule;
|
|
7
|
7
|
import org.junit.rules.ExpectedException;
|
|
8
|
8
|
|
|
9
|
9
|
public class HammingTest {
|
|
10
|
|
-
|
|
11
|
10
|
|
|
12
|
11
|
@Rule
|
|
13
|
12
|
public ExpectedException thrown = ExpectedException.none();
|
|
14
|
13
|
|
|
15
|
14
|
@Test
|
|
16
|
15
|
public void testNoDifferenceBetweenIdenticalStrands() {
|
|
17
|
|
- assertThat(Hamming.compute("A", "A"), is(0));
|
|
|
16
|
+ assertThat(new Hamming("A", "A").getHammingDistance(), is(0));
|
|
18
|
17
|
}
|
|
19
|
18
|
|
|
20
|
19
|
@Ignore
|
|
21
|
20
|
@Test
|
|
22
|
21
|
public void testHammingDistanceForSingleNucleotideStrand() {
|
|
23
|
|
- assertThat(Hamming.compute("A", "G"), is(1));
|
|
|
22
|
+ assertThat(new Hamming("A", "G").getHammingDistance(), is(1));
|
|
24
|
23
|
}
|
|
25
|
24
|
|
|
26
|
25
|
@Ignore
|
|
27
|
26
|
@Test
|
|
28
|
27
|
public void testHammingDistanceForSmallStrand() {
|
|
29
|
|
- assertThat(Hamming.compute("AG", "CT"), is(2));
|
|
|
28
|
+ assertThat(new Hamming("AG", "CT").getHammingDistance(), is(2));
|
|
30
|
29
|
}
|
|
31
|
30
|
|
|
32
|
31
|
@Ignore
|
|
33
|
32
|
@Test
|
|
34
|
33
|
public void testSmallHammingDistance() {
|
|
35
|
|
- assertThat(Hamming.compute("AT", "CT"), is(1));
|
|
|
34
|
+ assertThat(new Hamming("AT", "CT").getHammingDistance(), is(1));
|
|
36
|
35
|
}
|
|
37
|
36
|
|
|
38
|
37
|
@Ignore
|
|
39
|
38
|
@Test
|
|
40
|
39
|
public void testSmallHammingDistanceInLongerStrand() {
|
|
41
|
|
- assertThat(Hamming.compute("GGACG", "GGTCG"), is(1));
|
|
|
40
|
+ assertThat(new Hamming("GGACG", "GGTCG").getHammingDistance(), is(1));
|
|
42
|
41
|
}
|
|
43
|
42
|
|
|
44
|
43
|
@Ignore
|
|
45
|
44
|
@Test
|
|
46
|
45
|
public void testValidatesFirstStrandNotLonger() {
|
|
47
|
46
|
thrown.expect(IllegalArgumentException.class);
|
|
48
|
|
- Hamming.compute("AAAG", "AAA");
|
|
|
47
|
+ new Hamming("AAAG", "AAA");
|
|
49
|
48
|
}
|
|
50
|
49
|
|
|
51
|
50
|
@Ignore
|
|
52
|
51
|
@Test
|
|
53
|
52
|
public void testValidatesOtherStrandNotLonger() {
|
|
54
|
53
|
thrown.expect(IllegalArgumentException.class);
|
|
55
|
|
- Hamming.compute("AAA", "AAAG");
|
|
|
54
|
+ new Hamming("AAA", "AAAG");
|
|
56
|
55
|
}
|
|
57
|
56
|
|
|
58
|
57
|
@Ignore
|
|
59
|
58
|
@Test
|
|
60
|
59
|
public void testLargeHammingDistance() {
|
|
61
|
|
- assertThat(Hamming.compute("GATACA", "GCATAA"), is(4));
|
|
|
60
|
+ assertThat(new Hamming("GATACA", "GCATAA").getHammingDistance(), is(4));
|
|
62
|
61
|
}
|
|
63
|
62
|
|
|
64
|
63
|
@Ignore
|
|
65
|
64
|
@Test
|
|
66
|
65
|
public void testHammingDistanceInVeryLongStrand() {
|
|
67
|
|
- assertThat(Hamming.compute("GGACGGATTCTG", "AGGACGGATTCT"), is(9));
|
|
|
66
|
+ assertThat(new Hamming("GGACGGATTCTG", "AGGACGGATTCT").getHammingDistance(), is(9));
|
|
68
|
67
|
}
|
|
69
|
68
|
|
|
70
|
69
|
}
|