Ad
  • Custom User Avatar
  • Custom User Avatar

    Reported on github.

  • Custom User Avatar

    make is no longer accessible in solutions.

  • Custom User Avatar

    I've noticed several similarities to questions from practicepython.org and SoloLearn. Needs to be cited, agreed.

  • Custom User Avatar

    Usually I think codewarriors add what is needed and lots of guys passed the kata as it was and nobody complained.
    I just added "#include cmath". Thanks!

  • Custom User Avatar
  • Custom User Avatar

    In the example tests just test against fixed values. If the return type is too complex for a one-line cr_assert_equal add a test function (which can also provide better error messages and cleanup):

    #include <criterion/criterion.h>
    unsigned long long* eval(unsigned long long n);
    
    void test_eval(unsigned long long input, unsigned long long expected1, unsigned long long expected2)
    {
        unsigned long long expected[2] = {expected1, expected2};
        unsigned long long *actual = eval(input);
        if (actual)
            cr_assert_not(memcmp(actual, expected, sizeof(expected)),
                "eval(%llu) should return {%llu, %llu}, actual: {%llu, %llu}",
                input, expected1, expected2, actual[0], actual[1]);
        else
            cr_assert(actual, "eval(%llu) should not return NULL", input);
        free(actual);
    }
    
    Test(eval, should_pass_all_the_tests_provided)
    {
        test_eval(2134563, 246, 1353);
        test_eval(20468, 20468, 0);
    }
    

    Having this test function in the example tests makes it clear for everybody what happens, e.g. if the result is freed in the end.

  • Custom User Avatar

    It is in the preloaded section, How can do it properly then ?

  • Custom User Avatar

    Hi asmgf,

    fixed.

  • Custom User Avatar

    I solved this kata today and still got the same issue.

  • Custom User Avatar
    if ('12.12.2' <= 90){
      alert(1);
    }
    //  alert will not triggered
    
  • Custom User Avatar

    Thx, website looks good!

  • Custom User Avatar

    Somewhere you are not wrong... but one could have thought that the framework can handle different types of return.
    Sorry if I gave the impression that you could "Go away":-( It was not the case.
    I modified the tests, thanks for your posts.

  • Custom User Avatar

    It's not from the kata but from CW when there is an error in the code. If you have gotten a bad result the info would have been the same as in Python.
    No need to downvote my post. I could do the same to yours...
    BTW Python translation and all others were done by myself.

  • Custom User Avatar

    Fixed, sorry but English is not my mother tongue...

  • Loading more items...