Skip to content

Instantly share code, notes, and snippets.

@ga-wolf
Created February 24, 2015 21:58
Show Gist options
  • Save ga-wolf/0288b4aea24fd07ca833 to your computer and use it in GitHub Desktop.
Save ga-wolf/0288b4aea24fd07ca833 to your computer and use it in GitHub Desktop.
Test Suite for Nucleotide Warmup Exercise (25th Feb)
require 'minitest/autorun'
require 'minitest/pride'
require 'pry'
require_relative './nucleotide'
class DNATest < MiniTest::Test
def test_empty_dna_string_has_no_adenosine
# skip
assert_equal 0, DNA.new('').count('A')
end
def test_repetitive_cytidine_gets_counted
skip
assert_equal 5, DNA.new('CCCCC').count('C')
end
def test_counts_only_thymidine
skip
assert_equal 1, DNA.new('GGGGGTAACCCGG').count('T')
end
def test_dna_has_no_uracil
skip
assert_equal 0, DNA.new('GATTACA').count('U')
end
def test_validates_nucleotides
skip
assert_raises ArgumentError do
DNA.new("GACT").count('X')
end
end
def test_empty_dna_string_has_no_nucleotides
skip
expected = { 'A' => 0, 'T' => 0, 'C' => 0, 'G' => 0, 'U' => 0 }
assert_equal expected, DNA.new("").nucleotide_counts
end
def test_repetitive_sequence_has_only_guanosine
skip
expected = { 'A' => 0, 'T' => 0, 'C' => 0, 'G' => 8, 'U' => 0 }
assert_equal expected, DNA.new('GGGGGGGG').nucleotide_counts
end
def test_counts_all_nucleotides
skip
s = "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC"
dna = DNA.new(s)
expected = { 'A' => 20, 'T' => 21, 'G' => 17, 'C' => 12, 'U' => 0 }
assert_equal expected, dna.nucleotide_counts
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment