my-solutions/leetcode/0014-longest-common-prefix/test.rb

17 lines
357 B
Ruby
Raw Normal View History

2022-11-26 16:14:11 +05:00
require_relative 'main'
require 'test/unit'
2022-11-26 11:27:25 +05:00
class TestLCP < Test::Unit::TestCase
def test_simple
2022-11-26 16:14:11 +05:00
assert_equal('fl', longest_common_prefix(%w[flower flow flight]))
2022-11-26 11:27:25 +05:00
end
def test_empty_prefix
2022-11-26 16:14:11 +05:00
assert_equal('', longest_common_prefix(%w[dog racecar car]))
2022-11-26 11:27:25 +05:00
end
def test_empty_string
2022-11-26 16:14:11 +05:00
assert_equal('', longest_common_prefix(['']))
2022-11-26 11:27:25 +05:00
end
end