Add tests for bucket sort

This commit is contained in:
vzvu3k6k 2021-02-14 03:43:56 +09:00
parent aeb2478faa
commit fe52b262da
2 changed files with 17 additions and 3 deletions

View file

@ -19,7 +19,10 @@ def bucket_sort(array, bucket_size = DEFAULT_BUCKET_SIZE)
buckets.flatten
end
if $0 == __FILE__
puts 'Enter a list of numbers separated by space'
list = gets
print bucket_sort(list)
list = gets.split.map(&:to_i)
p bucket_sort(list)
end

View file

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