Sha256: e439a645f66c54c3b5b4d1fc7370aa2aa21e3306d3602b8e073c4f7b0991a859

Contents?: true

Size: 1.36 KB

Versions: 188

Compression:

Stored size: 1.36 KB

Contents

require 'minitest/autorun'
require_relative 'nucleotide_count'

class NucleotideTest < Minitest::Test
  def test_empty_dna_strand_has_no_adenosine
    assert_equal 0, Nucleotide.from_dna('').count('A')
  end

  def test_repetitive_cytidine_gets_counted
    skip
    assert_equal 5, Nucleotide.from_dna('CCCCC').count('C')
  end

  def test_counts_only_thymidine
    skip
    assert_equal 1, Nucleotide.from_dna('GGGGGTAACCCGG').count('T')
  end

  def test_counts_a_nucleotide_only_once
    skip
    dna = Nucleotide.from_dna('CGATTGGG')
    dna.count('T')
    dna.count('T')
    assert_equal 2, dna.count('T')
  end

  def test_empty_dna_strand_has_no_nucleotides
    skip
    expected = { 'A' => 0, 'T' => 0, 'C' => 0, 'G' => 0 }
    assert_equal expected, Nucleotide.from_dna('').histogram
  end

  def test_repetitive_sequence_has_only_guanosine
    skip
    expected = { 'A' => 0, 'T' => 0, 'C' => 0, 'G' => 8 }
    assert_equal expected, Nucleotide.from_dna('GGGGGGGG').histogram
  end

  def test_counts_all_nucleotides
    skip
    s = 'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC'
    dna = Nucleotide.from_dna(s)
    expected = { 'A' => 20, 'T' => 21, 'G' => 17, 'C' => 12 }
    assert_equal expected, dna.histogram
  end

  def test_validates_dna
    skip
    assert_raises ArgumentError do
      Nucleotide.from_dna('JOHNNYAPPLESEED')
    end
  end
end

Version data entries

188 entries across 188 versions & 1 rubygems

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