Ad
  • Custom User Avatar

    The user could modify the array and thus change the test.

    and it was actually the only thing that made the kata solvable, since the reference solution is wrong.

  • Custom User Avatar

    Creating good katas is hard. You have to come up with a fresh idea and that idea must fit into the concept of a kata. That's much harder than solving katas.
    But that's how it should be. As students we don't want a few good katas lost in a sea of mediocre ones, right?

    I'll make a prediction: This kata will not get enough positive votes to make it out of Beta.
    I'd suggest that you retire this kata and wait until you have an idea for something new.

  • Custom User Avatar

    There are several problems with this kata:

    • The outer loop in your own solution and the test only runs Math.ceil(Math.log2(array.length)) times. Imagine the smallest value is at the right. You need array.length - 1 iterations of the inner loop to get it to the left.
    • The first argument of the function it is a description of the test. "Yes" is not a description.
    • The tests use Test.assertSimilar(). That function converts both arguments to strings and compares those strings. The message is unnecessarily hard to read. Use Test.asserDeepEquals() instead.
    • Disabling a function is hard. You call bubbleSort.toString() and search that string for the substring "sort". There are many techniques to circumvent that, e.g. what mrtp0 did.
    • In the random tests you call the model solution after the user's solution. The user could modify the array and thus change the test.
    • But the biggest problem is: There is already a Bubble Sort kata. The task is slightly different but the central task is to implement bubble sort, too.
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution