6 kyu

T.T.T.39: Cut rope

103 of 177myjinxin2015
Description
Loading description...
Puzzles
Games
  • Please sign in or sign up to leave a comment.
  • mauro-1 Avatar
  • kazk Avatar

    In order to facilitate the test, please arrange according to the length of the ascending.

    Use Test.assertDeepEquals() instead of Test.assertSimilar(). Test.assertDeepEquals() is unaffected by insertion order and has cleaner message.

    Test.assertDeepEquals({"2cm":3,"1cm":4}, {"1cm":4,"2cm":3}); //=> Test Passed: Value deep equals { '1cm': 4, '2cm': 3 }
    Test.assertDeepEquals({"1cm":8,"2cm":6}, {"1cm":4,"2cm":3}); //=> Expected: { '1cm': 4, '2cm': 3 }, instead got: { '1cm': 8, '2cm': 6 }
    
    • myjinxin2015 Avatar

      I know that. ;-) But I didn't know Test.assertDeepEquals() when I created Kata, so I use Test.assertSimilar(). It's fixed now ;-) Most of my old Kata use this method(Test.assertSimilar()). But I am lazy and don't want to go one by one to change my old Kata, because they are too much ^_^

      Suggestion marked resolved by myjinxin2015 8 years ago
    • kazk Avatar

      Confirmed :)

      Also, remove

      In order to facilitate the test, please arrange according to the length of the ascending. For example: {"2cm":2,"1cm":2} will falled at expect value= {"1cm":2,"2cm":2}

      from the description as it's no longer necessary :)


      But I am lazy and don't want to go one by one to change my old Kata, because they are too much ^_^

      I made this suggestion because sorting was just a workaround for Test.assertSimilar and not really part of the challenge. No need to change every kata that uses Test.assertSimilar :]

    • myjinxin2015 Avatar

      Removed ;-)