6 kyu

Vertical symmetry on coordinate plane

61 of 64kdmatrosov
Description
Loading description...
Algorithms
Mathematics
Geometry
Puzzles
  • Please sign in or sign up to leave a comment.
  • kdmatrosov Avatar

    Updated auto tests added extra example tests (to solvers also) to check array with an odd number of elements

  • kdmatrosov Avatar

    Updated auto tests Now it can generate more than one pair on horizontal Added one more test to Example with 2/3/4 pairs on horizontal

  • JohanWiltink Avatar
  • JohanWiltink Avatar

    Approved.

    I have gone over the description a bit and made some cosmetic changes - hope you don't mind.

  • Unnamed Avatar

    This comment has been hidden.

  • JohanWiltink Avatar

    Spare us the input validation. It adds nothing ( but boring, mindnumbing makework ).

    An empty array should not be invalid. Any X should be a valid return value for an empty array. With a different way of testing, this would be obvious.

    Why specify 2 digit precision when this is not in any way tested?

    • kdmatrosov Avatar

      Thanks for feedback Removed validation. It was bad idea. Add real numbers, but now it seems to be unclear and thats why more difficult then it is

    • JohanWiltink Avatar

      The floating point values introduce inaccuracies. I fixed my solution by converting intermediate values to integers, which kind of defeats the point of using floating point values.

      It would seem the floating point values are about as useful as the input validation ..

    • JohanWiltink Avatar

      Any thought on empty arrays? They are not tested anymore, but they would seem to be valid input.

      ( The fact they aren't tested would deserve a mention in the description BTW )

    • kdmatrosov Avatar

      Made 0 for empty array, because it is center of coordinatre plane And you are totally right about floating point values. They were removed, and your solution came back

      Suggestion marked resolved by kdmatrosov 7 years ago
    • JohanWiltink Avatar

      Empty array is not being tested however.

    • kdmatrosov Avatar

      the second test is Test.assertEquals(checkVerticalSymmetry([]), 0);, it is right, isnt it? or you mean something else? I would be grateful if you could explain how I should check empty array

    • JohanWiltink Avatar

      That's an Example Test, isn't it? But you don't have to pass those; you only have to pass the Submit Tests. Submit Tests are random only.

    • kdmatrosov Avatar

      On publishing codewars checks my solution to pass both tests: Submit and Example. If Example test ruins, I cant update kata

    • JohanWiltink Avatar

      Maybe on publishing, but solvers do not have to pass the Example Tests. Really.

    • kdmatrosov Avatar

      took in! moved check for empty array to required tests. Thanks

      I must describe some tests for example and all cases for solvers

  • ZED.CWT Avatar

    You should create a function, which takes the array

    So, at least an array should be provided according to the desc

    Test.assertEquals(checkVerticalSymmetry(null), null);
    Test.assertEquals(checkVerticalSymmetry(), null);
    

    These cases do not make this kata more interesting. And it's not a good way to set catch about invalid input in the complete test, nope, you should list all possible invalid inputs form and the expected results.

  • ZED.CWT Avatar

    Random Tests are not well designed to include cases expecting null as result.