Commit c1b39b4
Changed files (3)
lib/insertion_sort.rb
@@ -0,0 +1,5 @@
+class InsertionSort
+ def sort(items)
+ items
+ end
+end
spec/insertion_sort_spec.rb
@@ -0,0 +1,12 @@
+require "spec_helper"
+
+describe InsertionSort do
+ it "should sort an empty array" do
+ InsertionSort.new.sort([]).should == []
+ end
+
+ it "should sort an array with one item" do
+ InsertionSort.new.sort([1]).should == [1]
+ end
+end
+
spec/spec_helper.rb
@@ -1,2 +1,3 @@
require 'benchmark'
require_relative '../lib/bubble_sort'
+require_relative '../lib/insertion_sort'