Sha256: 40208cc82d826c05cc101ce8a199144a0b83fdc070baa513e0aa236321c1f9c6

Contents?: true

Size: 1.38 KB

Versions: 45

Compression:

Stored size: 1.38 KB

Contents

#!/usr/bin/env ruby
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

45 entries across 45 versions & 1 rubygems

Version Path
trackler-2.1.0.53 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.52 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.51 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.50 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.49 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.48 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.47 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.46 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.45 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.44 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.43 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.42 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.41 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.40 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.39 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.38 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.37 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.36 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.34 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb
trackler-2.1.0.33 tracks/ruby/exercises/nucleotide-count/nucleotide_count_test.rb