Sha256: cb91de380c80b8434987751af2cba9dfc2df545222911333e8739852e132fa41
Contents?: true
Size: 1.57 KB
Versions: 45
Compression:
Stored size: 1.57 KB
Contents
#!/usr/bin/env ruby require 'minitest/autorun' require_relative 'point_mutations' class DNATest < Minitest::Test def test_no_difference_between_empty_strands assert_equal 0, DNA.new('').hamming_distance('') end def test_no_difference_between_identical_strands skip assert_equal 0, DNA.new('GGACTGA').hamming_distance('GGACTGA') end def test_complete_hamming_distance_in_small_strand skip assert_equal 3, DNA.new('ACT').hamming_distance('GGA') end def test_hamming_distance_in_off_by_one_strand skip strand = 'GGACGGATTCTGACCTGGACTAATTTTGGGG' distance = 'AGGACGGATTCTGACCTGGACTAATTTTGGGG' assert_equal 19, DNA.new(strand).hamming_distance(distance) end def test_small_hamming_distance_in_middle_somewhere skip assert_equal 1, DNA.new('GGACG').hamming_distance('GGTCG') end def test_larger_distance skip assert_equal 2, DNA.new('ACCAGGG').hamming_distance('ACTATGG') end def test_ignores_extra_length_on_other_strand_when_longer skip assert_equal 3, DNA.new('AAACTAGGGG').hamming_distance('AGGCTAGCGGTAGGAC') end def test_ignores_extra_length_on_original_strand_when_longer skip strand = 'GACTACGGACAGGGTAGGGAAT' distance = 'GACATCGCACACC' assert_equal 5, DNA.new(strand).hamming_distance(distance) end def test_does_not_actually_shorten_original_strand skip dna = DNA.new('AGACAACAGCCAGCCGCCGGATT') assert_equal 1, dna.hamming_distance('AGGCAA') assert_equal 4, dna.hamming_distance('AGACATCTTTCAGCCGCCGGATTAGGCAA') assert_equal 1, dna.hamming_distance('AGG') end end
Version data entries
45 entries across 45 versions & 1 rubygems