This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DNATest < MiniTest::Unit::TestCase | |
# You don't have to put your classes inside of the test case, but it | |
# doesn't hurt for these examples | |
class DNA | |
def initialize(string) | |
@string = string | |
# You can provide a default value for hashes. This also avoids | |
# hardcoding the letters here. | |
@counts = Hash.new(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AnagramTest < MiniTest::Unit::TestCase | |
class Anagram | |
def initialize(word) | |
@word = word | |
# If you create the array here, then the results will be | |
# collected over multiple calls to `match`. Not sure if that is | |
# intended or not, so I'll assume it's ok to change. | |
end |