Hi,
I was working on the simple linked list exercise and I couldn't help to wonder whether this assertion, which reads:
def test_list_multiple_to_array
skip
list = SimpleLinkedList.new
first = Element.new(1)
second = Element.new(2)
third = Element.new(3)
list.push(first).push(second).push(third)
assert_equal [3, 2, 1], list.to_a
end
was correct?
In my opinion, when adding an element to the list with the following code:
list = SimpleLinkedList.new
first = Element.new(1)
second = Element.new(2)
third = Element.new(3)
list.push(first).push(second).push(third)
I should get that :
=> [1, 2, 3]
in other word the assertion should be this:
assert_equal [1, 2, 3], list.to_a
I haven't finished the exercise yet but I'm curious to get your opinion on it. Thank you.
Conversation on the forums located here.
Hi,
I was working on the simple linked list exercise and I couldn't help to wonder whether this assertion, which reads:
was correct?
In my opinion, when adding an element to the list with the following code:
I should get that :
=> [1, 2, 3]in other word the assertion should be this:
assert_equal [1, 2, 3], list.to_aI haven't finished the exercise yet but I'm curious to get your opinion on it. Thank you.
Conversation on the forums located here.