Ad
  • Custom User Avatar

    Thanks for taking the time to review:

    • Float should be enough to handle the value of a car. I'm not going to push back if you think car method needs to recieve a Double, although I don't think double precision is needed in this particular case.
    • String is returned because the original kata version in clojure is returning a String - which btw I don't particularly like - if is legit to change the haskell translation to return Float or Double I'd be more than eager to do implement the change.
    • Good catch! I overlooked the import of Test.QuickCheck, I'll remove it.
    • Good point too, I'll give it a spin and add random tests - which the original kata is lacking too - need to go over the documentation though to find how to add them.
  • Custom User Avatar

    Haskell translation kumited.

  • Custom User Avatar

    Test harness for haskelll has an issue as reported below.
    If there's a way to contribute code to have the issue fixed I don't mind helping to have it fixed.

  • Custom User Avatar

    Thanks for the link!

  • Custom User Avatar

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

  • Custom User Avatar

    The test suite should include tests for null collection used in the constructor : many of the solutions accepted do not protect themselves against null pointer exception when calling collection.size() ;)

  • Custom User Avatar

    Can I suggest to add to the kata description details on how itemsPerPage == 0 should be dealt with or otherwise state clearly that this scenario can be completely ignored.

    Otherwise a very good kata - in particular like the object oriented approach as oposed to that many katas based on a single function to be solved.

  • Custom User Avatar

    I'd suggest to add some edge test cases to this kata:

    • test for rotation of a 0 length array
    • test for 0 rotation of an array
    • test for 0 rotation of a 0 lenght array

    I already implemented those for java in my submission. Pasting them here in case you want to make use of them:

        @Test
        public void testRotateZero_ArrayOfFive() {
            assertArrayEquals(new Object[]{1, 2, 3, 4, 5},
                    rotator.rotate(new Object[]{1, 2, 3, 4, 5}, 0));
        }
    
        @Test
        public void testRotateZero_ArrayOfZero() {
            assertArrayEquals(new Object[]{},
                    rotator.rotate(new Object[]{}, 0));
        }
    
        @Test
        public void testRotateOne_ArrayOfZero() {
            assertArrayEquals(new Object[]{},
                    rotator.rotate(new Object[]{}, 1));
        }
    
        @Test
        public void testRotateTwo_ArrayOfZero() {
            assertArrayEquals(new Object[]{},
                    rotator.rotate(new Object[]{}, 2));
        }
    
  • Custom User Avatar

    The ternary operator is redundant in this case

  • Custom User Avatar

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

  • Custom User Avatar

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