Ad
  • Default User Avatar

    as said by phaffywaffle above the line jaden_case[strlen(jaden_case)] = '\0'; is wrong, because it's tautological. By definition, if a string is nul-terminated, string[strlen(string)] == '\0'. So you werent nul-terminating jaden_case.

  • Custom User Avatar

    Yes, I'm sure I didn't. It took me some time to understand the kata precisely because of that test case I mention (it didn't make any sense, and I thought I was missing something). I wonder if there is any kind of test log to check if someone was editing the tests and forgot to finish or something similar.

    Anyway, when hitting ATTEMPT I was able to submit, so at least there's that :P

  • Custom User Avatar

    I cannot see such test case. The only one similar I see is this:

        {
            const unsigned expected[COUNTS_SIZE] = { ['a'] = 2, ['b'] = 2 };
            tester("aabb", expected);
        }
    

    Are you sure you did not modify the sample tests?

  • Custom User Avatar

    I saw something weird and I didn't really know where to report it, hope this is okay.

    In C, I noticed a test case that made no sense:

        {
            const unsigned expected[COUNTS_SIZE] = { ['A'] = 1, ['b'] = 2, ['?'] = 3 };
            tester("aabb", expected);
        }
    

    Unless I'm missing something, the expected result should not contain 'A' or '?'.

    Also, every other test was commented, so I came to raise an issue. However, I wanted to double check before posting, and now all the tests are okay and uncommented. Furthermore, seems like one of the tests in the "Test cases" section is missing when you try to solve the kata (the last one).

    Is this normal? Was someone messing up with this kata?

  • Default User Avatar
  • Custom User Avatar

    Thank you both, I got stuck at the time and now when I came back to check your comments, I didn't even understand my approach.

    It's been a month since I asked for help and now that I'm more used to this, I've been able to easily solve it, but I appreciate the help!

  • Custom User Avatar

    Unfortunately, SIGSEGV comes from sample tests, because they have a copy/paste error. Full tests seem to not have the error and they work. You can temporarily fix the error by replacing first assertion (lines 50-55) with:

        if(sub_len != exp_len) {
            cr_assert_fail(
                    "< Incorrect Size >\n \nsubmitted = %zu\n \nexpected = %zu",
                                              sub_len,        exp_len
            );
        }
    

    But stll, the SIGSEGV gets triggered only when your solution is incorrect, and it indeed has a mistake. It does not handle the sz_out correctly.

  • Default User Avatar

    getting a SIGSEGV is tough because AFAIK you can't tell what caused it until you stop doing it, so examine all places in your code where you attempt to access memory, then consider the possibilities of how that could go wrong

  • Custom User Avatar

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

  • Default User Avatar

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

  • Custom User Avatar

    The error message means that the tests expected this string to be the output from your function:
    'I Should Just Stop Tweeting, The Human Conciousness Must Raise Before I Speak My Juvenile Philosophy.'

    But instead your function returned this string:
    'How Can Mirrors Be Real If Our Eyes Aren't Real' to equal '

    Think about how your function could work with any string, rather than just the one you've pasted into your code. If you're still unsure, try to define a simpler function on String.prototype and call it on any string to see how it works.

  • Custom User Avatar

    You must read the log like this: expected "Your answer" to equal "The correct answer". Have a look there to debug your code: https://docs.codewars.com/training/troubleshooting

  • Default User Avatar

    what is this? expected 'How Can Mirrors Be Real If Our Eyes Aren't Real' to equal 'I Should Just Stop Tweeting, The Human Conciousness Must Raise Before I Speak My Juvenile Philosophy.'

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Loading more items...