Retired

Parse IPv6 Address (retired)

Description
Loading description...
Algorithms
Regular Expressions
  • Please sign in or sign up to leave a comment.
  • Voile Avatar

    This kata expects 1 group of zeroes to be contracted to ::, which violates the actual IPv6 spec: when there is only 1 group of zeroes 0 is retained instead of ::.

    (This applies to both at the ends and at the middle.)

  • Voile Avatar

    This kata is a duplicate of https://www.codewars.com/kata/54fa4e210609868fce0002bf

    And this kata's test cases are less comprehensive as https://www.codewars.com/kata/5722d87c785220f5780013cf (there are some edge cases that only exists in that kata)

  • Voile Avatar

    Needs random tests.

  • tr0tt3l Avatar

    Me again. ^ Found some time again for your kata, but gettin the message at test 26 : "False should equal '::FFFF:C0A8:101:A0CD'". Test runs false at my code, because i test for valid segment lengths. Please fix it, or tell me where I'm going wrong! :-D

    • TheBMachine Avatar

      It is a valid address, all segments have a valid length. The only way a segment can have an invalid length is if it has more than 4 characters - if it has less, it simply has trailing zeros removed.

      EDIT: I see what you mean now - there are 3 segments after the FFFF segment. This means that the address is indeed not a valid IPv4-mapped address; it is, however, a valid regular IPv6 address.

    • tr0tt3l Avatar

      thank you! maybe you should update the instructions for noobs like me, and mention that it is neccessary to remove the trailing zeros too. I thought only blocks containing only zeros can be shortened.

    • TheBMachine Avatar

      Hang on, my bad - trailing zero's shouldn't be removed, leading zeros should be! (although the test in question doesn't have trailing zeros at all)

  • tr0tt3l Avatar

    the second testcase has 8 segments, just as IPv6 should have. Or am I missing something? Nice Kata anyway. :-)