Ad
  • Custom User Avatar

    You do have a point about the Gregorian calendar not being invented until 1582 and many palces did not adopt the use of it until much later. On the other hand the Gregorian calendar as implemented in PHP has a valid range from 4714 BCE to 9999 CE. I think it is perfectly ok to use our current calendar (the Gregorian) to find days and dates in both history and future, and from that perspective the calculated Sundays would be correct.

  • Custom User Avatar

    Your explanation makes sense, but it is fairly easy to spot the mistake when writing or changing the tests. If all 'noice' is removed the test is trying to assert that 0 is the same as 0.0:
    $this->assertSame([0], moveZeroes([0.0]));

    As you say, at this moment all zeroes must be converted to integer 0 or the tests with non integer zeroes will fail. It does add some interesting complexity to the kata that you have to find different kinds of zeroes and move them, but it is also not clear in the instructions if you have to keep the order of your zeroes when moving them to the end.

  • Custom User Avatar

    In PHP the second test includes 0.0 in its values:
    $this->assertSame([9,9,1,2,1,1,3,1,9,9,0,0,0,0,0,0,0,0,0,0], moveZeros([9,0.0,0,9,1,2,0,1,0,1,0.0,3,0,1,9,0,0,0,0,9]));

    the digit 0.0 are counted as a zero but expected to be a single zero after moving to the end. All tests will pass if a single 0 is added to the end for any digit that evaluats as 0 (including 0.0).