Sha256: f942a3202dd275e67ea08308e23a2f94ee286f1ac15435c8f0aa1296fa95c6d2

Contents?: true

Size: 1.55 KB

Versions: 188

Compression:

Stored size: 1.55 KB

Contents

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

188 entries across 188 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.179 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.178 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.177 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.176 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.175 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.174 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.173 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.172 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.171 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.170 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.169 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.167 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.166 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.165 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.164 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.163 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.162 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.161 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.2.1.160 tracks/ruby/exercises/point-mutations/point_mutations_test.rb