small word test

This commit is contained in:
Torsten Ruger 2016-12-31 15:17:45 +02:00
parent 47c0f62212
commit 7bb1c361a5
2 changed files with 13 additions and 2 deletions

View File

@ -162,7 +162,7 @@ module Parfait
# compare the word to another
# currently checks for same class, though really identity of the characters
# in right order would suffice
def == other
def compare( other )
return false if other.class != self.class
return false if other.length != self.length
len = self.length

View File

@ -1,5 +1,5 @@
require_relative "../helper"
module Parfait
class TestEmptyWord < MiniTest::Test
def setup
@ -99,4 +99,15 @@ class TestWord < MiniTest::Test
assert_equal v , @word.get_char(k)
end
end
def test_not_same
one = Parfait.new_word("one")
two = Parfait.new_word("two")
assert !one.compare(two)
end
def test_is_same
one = Parfait.new_word("one")
two = Parfait.new_word("one")
assert one.compare(two)
end
end
end