Ad
  • Default User Avatar

    I do. Do you want to try to find it first? If not I'll tell you now...

  • Default User Avatar

    Few people are refactoring; Good Job

  • Default User Avatar

    Isn't programing for speed (O(n) time vs O(n Squared) time) a best practice???

  • Default User Avatar

    Your solution has a potential crash bug in it; the same one that mine has.
    Do you see it? (The Kata Test can't catch it that's why ours passed)

  • Default User Avatar

    No falut in the Kata; it could not have caught it...

  • Default User Avatar

    My "solution" has a severe bug, do you see it?

  • Default User Avatar

    Assume! That sounds reall good.

    I'm very impressed with your turn around time and dedication!

  • Default User Avatar

    Minor issue since as you pointed out you can still do the Kata...

  • Default User Avatar

    If you look at the test code:

    #define ASSERT_ARR_EQ(expected, submitted, sz)
    if(sz == 0 && submitted != NULL)
    { free(submitted); submitted = NULL;
    cr_assert(0, "n == 0, should return NULL\n"); }
    for(size_t i=0; i<sz; i++)
    if(submitted[i] != expected[i])
    cr_assert(0,
    "Incorrect value at index %i: %lld should equal %lld\n",
    i, submitted[i], expected[i]);
    cr_assert(1);

    It does not NULL check submitted if sz != 0...

  • Default User Avatar

    Actually when I simply return NULL there does appear to be a testing error:

    Test Results:
    Sample_Tests
    should_pass_all_the_tests_provided
    Test Crashed
    Caught unexpected signal: SIGSEGV (11). Invalid memory access.

    Should the Test crash?

    NULL is supposed to mean 'empty array' in this test.
    Shouldn't it be reported as a wrong return value as opposed to the test crashing?

  • Default User Avatar

    Ah yes, Correct.

    I guess my mind set is warings == errors

    I don't let warnings stand because they either contain important info or obscure other important info when out of hand...

  • Default User Avatar

    I believe this kata has bugs in C. If I do nothing but return null I get 8 pages of errors starting with (note error is in fixture.c):

    fixture.c:24:29: warning: passing 'const long long *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    ASSERT_ARR_EQ(expected, submitted, n);
    ^~~~~~~~~
    fixture.c:7:14: note: expanded from macro 'ASSERT_ARR_EQ'
    { free(submitted); submitted = NULL;
    ^~~~~~~~~
    /usr/include/stdlib.h:563:25: note: passing argument to parameter '__ptr' here
    extern void free (void *__ptr) THROW;
    ^
    fixture.c:24:5: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
    ASSERT_ARR_EQ(expected, submitted, n);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    fixture.c:13:17: note: expanded from macro 'ASSERT_ARR_EQ'
    i, submitted[i], expected[i]);
    ^
    /usr/include/criterion/internal/assert.h:529:62: note: expanded from macro 'cr_assert'
    #define cr_assert(...) CR_EXPAND(cr_assert
    (VA_ARGS))
    ^~~~~~~~~~~
    /usr/include/criterion/internal/assert.h:159:28: note: expanded from macro 'cr_assert
    '
    CR_VA_TAIL(VA_ARGS)
    ^~~~~~~~~~~
    note: (skipping 31 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
    /usr/include/criterion/internal/preprocess.h:35:43: note: expanded from macro 'CR_EXPAND'
    #define CR_EXPAND(x) x
    ^

  • Default User Avatar

    I would have voted for best practices if 'a' was used instead of 97 etc...

  • Default User Avatar

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

  • Default User Avatar

    The parameter 'a' of twos_difference is supposed to be (const int *) according to the kata

  • Loading more items...