Added test for insert function

This commit is contained in:
Deepi Garg 2020-03-28 20:04:59 +05:30 committed by GitHub
parent 5804a6a74d
commit bc04efadec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,5 +26,19 @@ module Parfait
@word.set_char(1 , 32)
end
end
def test_insert
a = Parfait.new_word("abc")
b = Parfait.new_word("d")
ans = Parfait.new_word("abcd")
assert_equal ans, a.insert(-1,b)
a1 = Parfait.new_word("what name")
b1 = Parfait.new_word("is your ")
ans = Parfait.new_word("what is your name")
assert_equal ans, a1.insert(5, b1)
a2 = Parfait.new_word("life")
b2 = Parfait.new_word("sad ")
ans = Parfait.new_word("sad life")
assert_equal ans, a2.insert(0, b2)
end
end
end