Ad
  • Custom User Avatar

    The "random tests" are not really random in Python, JavaScript, Java, and PHP.

    Stop resolving issues without fixing them (or even understanding why something is wrong).

  • Custom User Avatar

    Thank you! I'll fix that.

  • Custom User Avatar

    I have no idea why that solution works. What am I missing? I don't allow 4 and 7 in random tests because I've already tested for them, and It's simpler and makes no difference at that point whether or not I hard code it to expect 0.

  • Custom User Avatar

    My bad about randInt, hadn't check your definition.
    Check this solution: https://www.codewars.com/kata/reviews/5ff915f245ef420001b27754/groups/5ffcfa45803c080001286509 why don't you allow 4 and 7 in random tests? I think he meant the input is random but the output isn't.

  • Custom User Avatar

    Java and PHP use Expected - Actual instead of Actual - Expected order in the assertions (that's how those testing frameworks work, there is nothing wrong with that), so in PHP:

    $this->assertEquals(solution(4), 7); //should be
    $this->assertEquals(7, solution(4));
    

    And in Java:

    assertEquals(Kata.fourSeven(7), 4); //should be
    assertEquals(4, Kata.fourSeven(7));
    
  • Custom User Avatar

    I can't figure out how to change what each test displays in these two languages. It is just displaying the default for each test framework, so if the default for each test framework is wrong, there's not really anything I can do about that.

  • Custom User Avatar

    randInt never returns 4 or 7. check the definition. And what do you mean not really random? It uses the random functionality of each language.

  • Custom User Avatar

    Actual and expected values are flipped in Java and PHP.

  • Default User Avatar

    looks like java test output is flipped. this is an issue.

  • Custom User Avatar

    Indeed. But it seems that author simply forgot to generate a new number on 4 or 7, because the expected result is hardcoded to be 0.

  • Custom User Avatar

    At least in javascript, couldn't they expect a wrong result too?

    let r = randInt(-100, 100) // this could return 4 or 7
    
  • Default User Avatar

    Log
    number =7

    expected:<21> but was:<4>

    wtf? by condition it should be 4 if number was 7

  • Default User Avatar

    Hi, you don't have to parse "array[n]" and "n" into double as there is no loss when passing from int to double (but the reverse is wrong!).

  • Default User Avatar

    Same problem :c