Skip to content

Instantly share code, notes, and snippets.

@snoozer05
Last active July 15, 2019 10:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snoozer05/86b838fdb2a333f86392b36a9184709f to your computer and use it in GitHub Desktop.
Save snoozer05/86b838fdb2a333f86392b36a9184709f to your computer and use it in GitHub Desktop.
# 複数の文字列から前方一致部分の文字列を取り出す
def forward_match(strs)
#TODO
end
# ruby forward_match.rb
if $0 == __FILE__
require 'minitest/autorun'
class ForwardMatchTest < Minitest::Test
def test_simple_forward_match_array_size_is_two
assert_equal 'abcd', forward_match(['abcdef', 'abcdxyz'])
end
def test_simple_forward_match_array_size_is_three
assert_equal 'abc', forward_match(['abcdef', 'abcdxyz', 'abcABC'])
end
def test_complex_forward_match_array_size_is_two
assert_equal 'abcd', forward_match(['abcdef', 'abcdxfz'])
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment