| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- import org.junit.Ignore;
- import org.junit.Rule;
- import org.junit.Test;
- import org.junit.rules.ExpectedException;
-
- import static org.junit.Assert.assertEquals;
-
- /*
- * version: 1.1.0
- */
- public class HammingTest {
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @Test
- public void testNoDistanceBetweenEmptyStrands() {
- assertEquals(0, new Hamming("", "").getHammingDistance());
- }
-
- @Ignore("Remove to run test")
- @Test
- public void testNoDistanceBetweenShortIdenticalStrands() {
- assertEquals(0, new Hamming("A", "A").getHammingDistance());
- }
-
- @Ignore("Remove to run test")
- @Test
- public void testNoDistanceBetweenLongIdenticalStrands() {
- assertEquals(0, new Hamming("GGACTGA", "GGACTGA").getHammingDistance());
- }
-
- @Ignore("Remove to run test")
- @Test
- public void testCompleteDistanceInSingleNucleotideStrand() {
- assertEquals(1, new Hamming("A", "G").getHammingDistance());
- }
-
- @Ignore("Remove to run test")
- @Test
- public void testCompleteDistanceInSmallStrand() {
- assertEquals(2, new Hamming("AG", "CT").getHammingDistance());
- }
-
- @Ignore("Remove to run test")
- @Test
- public void testSmallDistanceInSmallStrand() {
- assertEquals(1, new Hamming("AT", "CT").getHammingDistance());
- }
-
- @Ignore("Remove to run test")
- @Test
- public void testSmallDistanceInMediumStrand() {
- assertEquals(1, new Hamming("GGACG", "GGTCG").getHammingDistance());
- }
-
- @Ignore("Remove to run test")
- @Test
- public void testSmallDistanceInLongStrand() {
- assertEquals(2, new Hamming("ACCAGGG", "ACTATGG").getHammingDistance());
- }
-
- @Ignore("Remove to run test")
- @Test
- public void testNonUniqueCharacterInFirstStrand() {
- assertEquals(1, new Hamming("AGA", "AGG").getHammingDistance());
- }
-
- @Ignore("Remove to run test")
- @Test
- public void testNonUniqueCharacterInSecondStrand() {
- assertEquals(1, new Hamming("AGG", "AGA").getHammingDistance());
- }
-
- @Ignore("Remove to run test")
- @Test
- public void testSameNucleotidesInDifferentPositions() {
- assertEquals(2, new Hamming("TAG", "GAT").getHammingDistance());
- }
-
- @Ignore("Remove to run test")
- @Test
- public void testLargeDistanceInPermutedStrand() {
- assertEquals(4, new Hamming("GATACA", "GCATAA").getHammingDistance());
- }
-
- @Ignore("Remove to run test")
- @Test
- public void testLargeDistanceInOffByOneStrand() {
- assertEquals(9, new Hamming("GGACGGATTCTG", "AGGACGGATTCT").getHammingDistance());
- }
-
- @Ignore("Remove to run test")
- @Test
- public void testValidatesFirstStrandNotLonger() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("leftStrand and rightStrand must be of equal length.");
-
- new Hamming("AATG", "AAA");
- }
-
- @Ignore("Remove to run test")
- @Test
- public void testValidatesSecondStrandNotLonger() {
- expectedException.expect(IllegalArgumentException.class);
- expectedException.expectMessage("leftStrand and rightStrand must be of equal length.");
-
- new Hamming("ATA", "AGTG");
- }
-
- }
|