Ad
  • Default User Avatar

    Thank you very much for your suggestions, it will be fixed.(:

  • Custom User Avatar

    Issues:

    • Some names (ZeroTest, BasicTest) do not adhere to Java naming conventions.
    • Reference solution function should be private.
    • An instance of Random is recreated on every repeated test. Maybe just a Random field in the test class, or ThreadLocalRandom, would be better?
    • Please try to use @Order annotation to enforce random tests to be run as last.

    Suggestions:

    • Imports in submission tests are terribly unordered, maybe they could be organized a bit: generic utilities first, followed by 3rd party libraries (JUnit)?
  • Default User Avatar

    Hello, the code would already be updated, when you can I would like to know if it would already be valid.

  • Default User Avatar

    Thanks for the feedback!

  • Default User Avatar

    Thanks for the feedback!

  • Custom User Avatar

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

  • Custom User Avatar

    Hi,

    • the description is missing half of the specs (allowed chars in the inputs, number of spaces)
    • the code block (description) is unreadable
    • the sample tests should reflect the inputs of the hidden tests
    • we already have hundreds of tasks like this one, we don't need more of them.
    • the solution should never be declared in the preloaded section, it must be a private method of the test class

    Cheers

  • Default User Avatar

    Hello, the code would already be updated, when you can I would like to know if it would already be valid.

  • Custom User Avatar
    • Submission tests call the method giveChange, but sample tests and initial soluton setup contain method GiveChange.
    • Indentation is a real mess. I am not sure why, but code of all of you guys seems as it was written in Notepad without any formatting capabilities. It would be really helpful if indentation and spacing was consistently maintained in thorough the code of all snippets.
    • Failed assertion message currently is:
    Was expected(0,1,1,0,1,3) received([0, 0, 0, 0, 0, 0]) ==> array contents differ at index [1], expected: <1> but was: <0>
    

    which is nice, but is still missing some useful info, and has some issues with formatting. My suggestion would be something like:

      private void doTest(int amount, int[] expected) {
        int[] actual = Kata.giveChange(amount);
        String msg = String.format(
          "Incorrect answer for amount = %d\n  Expected: %s\n  Actual:   %s\n",
          amount,
          Arrays.toString(expected),
          Arrays.toString(actual  )
        );
        assertArrayEquals(expected, actual, msg);
      }
      
        @Test
        void basicTest() {
          doTest(365, new int[] {0, 1, 1, 0, 1, 3});
          doTest(217, new int[] {2, 1, 1, 0, 0, 2});
          doTest( 25, new int[] {0, 1, 0, 1, 0, 0});
        }
    

    And use doTest also in random tests.

    • Could you possibly think of an English equivalent of billetes? Maybe bills, or denominations?
  • Default User Avatar

    Thanks for your constructive criticism. I have edited the translation code. Could you take a look?

  • Custom User Avatar
    • Names do not conform to Java naming conventions (method names should be camelCase)
    • Tests could have some cases which would guarantee to cover all kinds of bills. Currently, there is no test case which would validate correctness of $20 bills.
    • Feedback of failed tests could be improved to help users with debugging, for example by using custom assertion messages and presenting input of a failed test.
    • Imports for Assertions.assertEquals are not necessary.

    Please see Translation authoring guidelines for ideas on creating good quality translations. Please visit Codewars Discord and #help-translate channel if you need help with creating translations.