Ad
  • Custom User Avatar

    Needs random tests.

  • Custom User Avatar

    "Look at the test for the entire spec" is not an acceptable form of description. The description should be self-sufficient to describe the task (unless the whole point is to figure out the task, but this kata isn't one of them).

  • Custom User Avatar

    Ranking cannot be changed (anymore)

  • Default User Avatar

    I also agree. It use to be hard for me to do a 5 kyu, or even 6 kyu, and this seemed very easy to me.

  • Default User Avatar

    I agree. This exercise seemed much easier than other 4kyu kata.

  • Default User Avatar

    Shouldn't be 4 kyu, more like 6.

  • Default User Avatar

    Better regex, more logical, and more efficient than a lot of the other solutions I've seen. What do you think?

  • Default User Avatar

    Doesn't this call lcm for each element? That doesn't sound clever.

  • Custom User Avatar

    no worries, good luck :)

  • Default User Avatar

    Thanks matt, that's great. Much appreciated.

  • Custom User Avatar

    put simply you've returned the wrong answer, run these test cases for a more detailed and responsive version..

    
    collection = (1..24).to_a
    helper = PaginationHelper.new(collection, 10)
    
    Test.assert_equals(helper.page_count, 3, 'page_count is returning incorrect value.')
    Test.assert_equals(helper.page_item_count(1), 10, 'page_item_count is returning incorrect value.')
    Test.assert_equals(helper.page_item_count(2), 4, 'page_item_count is returning incorrect value')
    Test.assert_equals(helper.page_item_count(3), -1, 'page_item_count is returning incorrect value')
    
    Test.assert_equals(helper.page_index(23), 2, 'page_index returned incorrect value')
    Test.assert_equals(helper.page_index(24), -1, 'page_index returned incorrect value when provided a item_index argument that was out of range')
    Test.assert_equals(helper.page_index(40), -1, 'page_index returned incorrect value when provided a item_index argument that was out of range')
    Test.assert_equals(helper.page_index(3), 0, 'page_index returned incorrect value')
    Test.assert_equals(helper.page_index(-1), -1, 'page_index returned incorrect value when provided a itemIndex argument that was out of range. pageIndex(-1) should return -1')
    Test.assert_equals(helper.page_index(-23), -1, 'page_index returned incorrect value when provided a item_index argument that was out of range. pageIndex(-23) shoudl return -1')
    Test.assert_equals(helper.page_index(-15), -1, 'page_index returned incorrect value when provided a item_index argument that was out of range.')
    
    Test.assert_equals(helper.item_count, 24, 'item_count returned incorrect value')
    
    helper = PaginationHelper.new([], 10)
    Test.assert_equals(helper.page_index(0), -1, 'pageIndex(0) called when there was an empty collection')
    
    
  • Default User Avatar

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

  • Custom User Avatar

    you still haven't specified the error..
    or your actual code you've written

  • Default User Avatar

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

  • Custom User Avatar

    When reporting an issue it is very important you post information because nothing can be done when no information is supplied.

    Please post your code below and mark it as a spoiler and also add some information about the issue,

    Thanks :)

  • Loading more items...