Sha256: ebe3145990173d44580e9b87982f7c92fd3c4e81fe682689b248dea46a276fd8

Contents?: true

Size: 1.6 KB

Versions: 163

Compression:

Stored size: 1.6 KB

Contents

#!/usr/bin/env ruby
gem 'minitest', '>= 5.0.0'
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

163 entries across 163 versions & 1 rubygems

Version Path
trackler-2.1.0.7 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.1.0.6 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.1.0.5 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.1.0.4 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.1.0.3 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.1.0.2 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.1.0.1 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.1.0.0 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.0.8.55 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.0.8.54 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.0.8.53 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.0.8.52 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.0.8.51 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.0.8.50 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.0.8.49 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.0.8.48 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.0.8.47 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.0.8.46 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.0.8.45 tracks/ruby/exercises/point-mutations/point_mutations_test.rb
trackler-2.0.8.44 tracks/ruby/exercises/point-mutations/point_mutations_test.rb