Ad
  • Custom User Avatar

    Added all of these to description

  • Custom User Avatar

    There are no negative numbers in test, but yes. It must be specified

  • Custom User Avatar

    Also, the task asked for in this kata is basically already covered by std::snprintf (and std::format for C++20 and above). There is not much reason to reinvent this wheel in a language where this is built-in.

  • Custom User Avatar

    If you encounter a double or float type, add that to string with 6 precision."

    First, it is actually 6 decimal places, because you didn't configure the precision. Second, rounding can happen if the number has more than 6 decimal places, but this is not tested.

    Negative numbers are not tested either.

  • Custom User Avatar

    There are no random tests.

  • Custom User Avatar

    why do we have to return an empty array if no string is given?

  • Custom User Avatar

    Hello, the issue was in my code, that i tried to access an element on an index that is more than std::string.size(), which put '\0' in somewhere else in the variable.

  • Custom User Avatar

    if someone made a pull request to snowhouse to encode strings better, they might just accept that and then it would apply to all cpp kata

  • Custom User Avatar
  • Custom User Avatar

    Unfortunately, this is something what can happen in C++ and it's not easy to do anything aobut this. Your solution has a bug, and at some place it puts \0 into some of the pieces. Later, the failure message is build, the \0 gets in a middle of it, and when printed, everything beyond the zero character gets cut off.

    In your example, your first chunk is "a\0", and when it is used as a part of the failure message, the message is not printed fully because the \0 is considered he end of the string.

    I can see how it is a problem, but it is not a bug in the kata, and it's not something what can be fixed very easily. Unfortunately, some low-level languages are like that, and C and C++ are the most common offenders in this regard.

  • Custom User Avatar

    Writing in C++, i got an error on tests:

    even_length
      Expected: [ "ab", "cd", "ef" ]
      Actual: [ "a
    odd_length
      Expected: [ "ab", "cd", "e_" ]
      Actual: [ "a
    

    This error messages are invalid. Even if my code was wrong, it's not possible to send an array/string without closing symbols : quote and brace.