21 lines
260 B
Ruby
21 lines
260 B
Ruby
require 'sorting'
|
|
|
|
|
|
def test_insertion_sort
|
|
tmpl = [8, 2, 4, 9, 3, 6]
|
|
a = Array.copy(tmpl)
|
|
expected = [2, 3, 4, 6, 8, 9]
|
|
|
|
insertion_sort(a)
|
|
|
|
if expected != a
|
|
throw Exception.new 'OMG FAIL'
|
|
else
|
|
puts 'YAY!'
|
|
end
|
|
|
|
end
|
|
|
|
|
|
test_insertion_sort
|