2011-08-18 04:07:47 +00:00
|
|
|
require 'test/unit'
|
2011-08-18 03:07:18 +00:00
|
|
|
require 'sorting'
|
|
|
|
|
|
|
|
|
2011-08-18 04:07:47 +00:00
|
|
|
class TestSorting < Test::Unit::TestCase
|
|
|
|
def test_insertion_sort
|
|
|
|
tmpl = [8, 2, 4, 9, 3, 6]
|
|
|
|
a = Array.new(tmpl)
|
|
|
|
expected = [2, 3, 4, 6, 8, 9]
|
2011-08-18 03:07:18 +00:00
|
|
|
|
2011-08-18 04:07:47 +00:00
|
|
|
insertion_sort(a)
|
|
|
|
assert_equal(expected, a)
|
2011-08-18 03:07:18 +00:00
|
|
|
end
|
|
|
|
end
|