Add tests for merge sort

This commit is contained in:
vzvu3k6k 2021-02-17 02:31:11 +09:00
parent a88eaa82a7
commit c14e58f068
2 changed files with 17 additions and 3 deletions

View file

@ -28,6 +28,9 @@ def merge_sort(array)
result
end
puts 'Enter a list of numbers separated by space'
list = gets
print merge_sort list.split(' ').map(&:to_i)
if $0 == __FILE__
puts 'Enter a list of numbers separated by space'
list = gets.split.map(&:to_i)
p merge_sort(list)
end

View file

@ -0,0 +1,11 @@
require 'minitest/autorun'
require_relative './sort_tests'
require_relative './merge_sort'
class TestMergeSort < Minitest::Test
include SortTests
def sort(input)
merge_sort(input)
end
end