Add tests for insertion sort

This commit is contained in:
vzvu3k6k 2021-02-17 02:14:52 +09:00
parent ac449e637c
commit a88eaa82a7
2 changed files with 17 additions and 4 deletions

View file

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

View file

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