Test reverse.
parent
b52ef159e4
commit
ea6017a1c9
|
@ -48,4 +48,10 @@ describe "DoubleLinkedList" do
|
||||||
|
|
||||||
list.size.should eq 0
|
list.size.should eq 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "reverse" do
|
||||||
|
list = DoubleLinkedList(Int32).new
|
||||||
|
list << 1 << 2 << 3 << 4
|
||||||
|
list.reverse.to_s.should eq "[ 4, 3, 2, 1 ]"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -264,7 +264,7 @@ class DoubleLinkedList(V)
|
||||||
# values = [1, 2, 3]
|
# values = [1, 2, 3]
|
||||||
# list = DoubleLinkedList(Int32).new(values)
|
# list = DoubleLinkedList(Int32).new(values)
|
||||||
# list.each do |elem|
|
# list.each do |elem|
|
||||||
# puts elem
|
# puts elem
|
||||||
# end
|
# end
|
||||||
def each
|
def each
|
||||||
each_node do |node|
|
each_node do |node|
|
||||||
|
|
Loading…
Reference in New Issue