exercism / ruby

Exercism exercises in Ruby.
https://exercism.org/tracks/ruby
MIT License
555 stars 518 forks source link

palindome-products: confusing test assertion #945

Closed jdsutherland closed 2 years ago

jdsutherland commented 5 years ago

I started working on this exercise and noticed something fishy about the first test case: https://github.com/exercism/ruby/blob/66c5ebe6e30e740785de75fc5440588803a62a19/exercises/palindrome-products/palindrome_products_test.rb#L10

I haven't completed the exercise yet (so I don't have a worked out understanding of why this might have been done) but it seems odd that the products are repeated and this seems to differ from other tracks: javascript

python

go

jdsutherland commented 5 years ago

I originally overlooked that this is using an assert_includes (rather than equals). I'm guessing that this is failures due to array ordering. I'm not used to using minitest so maybe this is standard looking stuff.

I would argue that it's a bit confusing as it's the first test the reader is likely to see while in that initial state of trying to figure out what the problem output is expecting and it isn't immediately obvious that the array is repeated due to test framework details (IIRC, RSpec's match_array works independent of ordering).

Perhaps this confusion can be reduced by making this test work independent of array ordering similar to the other tracks?

kotp commented 5 years ago

See #305 for some backstory.

kytrinyx commented 2 years ago

Palindrome Products is now a part of the problem-specifications (language-agnostic test instructions and test cases), here: https://github.com/exercism/problem-specifications/tree/main/exercises/palindrome-products

The exercise has undergone significant improvements in the past few years and this repository is up-to-date with the current changes as of this date.

I am going to go ahead and close this issue.