-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathhamming_test.rb
More file actions
75 lines (61 loc) · 1.62 KB
/
hamming_test.rb
File metadata and controls
75 lines (61 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
gem 'minitest', '>= 5.0.0'
require 'minitest/autorun'
require_relative 'hamming'
class HammingTest < Minitest::Test
def test_identical_strands
skip
assert_equal 0, Hamming.compute('A', 'A')
end
def test_long_identical_strands
skip
assert_equal 0, Hamming.compute('GGACTGA', 'GGACTGA')
end
def test_complete_distance_in_single_nucleotide_strands
skip
assert_equal 1, Hamming.compute('A', 'G')
end
def test_complete_distance_in_small_strands
skip
assert_equal 2, Hamming.compute('AG', 'CT')
end
def test_small_distance_in_small_strands
skip
assert_equal 1, Hamming.compute('AT', 'CT')
end
def test_small_distance
skip
assert_equal 1, Hamming.compute('GGACG', 'GGTCG')
end
def test_small_distance_in_long_strands
skip
assert_equal 2, Hamming.compute('ACCAGGG', 'ACTATGG')
end
def test_non_unique_character_in_first_strand
skip
assert_equal 1, Hamming.compute('AGA', 'AGG')
end
def test_non_unique_character_in_second_strand
skip
assert_equal 1, Hamming.compute('AGG', 'AGA')
end
def test_large_distance
skip
assert_equal 4, Hamming.compute('GATACA', 'GCATAA')
end
def test_large_distance_in_off_by_one_strand
skip
assert_equal 9, Hamming.compute('GGACGGATTCTG', 'AGGACGGATTCT')
end
def test_empty_strands
skip
assert_equal 0, Hamming.compute('', '')
end
def test_disallow_first_strand_longer
skip
assert_raises(ArgumentError) { Hamming.compute('AATG', 'AAA') }
end
def test_disallow_second_strand_longer
skip
assert_raises(ArgumentError) { Hamming.compute('ATA', 'AGTG') }
end
end