Ad
  • Default User Avatar

    Thanks for your feedback. I'm not sure I understand the concern over using namespace std;, but I'll spend some time on the doc you linked and do some experimentation. For now I've unpublished the translation.

    You are right about the floats and Equals. I missed that detail. It'll be corrected before I republish. I'll take a look at your earlier note regarding the error messages when I have time later. Thanks!

  • Custom User Avatar

    Could you address this? Is that indeed the most practical solution?

  • Custom User Avatar

    Due to specific C++ setup on Codewars, using namespace std; can be safely used only in test snippets, and not in the "complete solution", "solution setup", or in "preloaded" snippet (https://docs.codewars.com/languages/cpp/authoring#using-directives).

    Another bug in the translation: floats should not be compared for strict equality with Equals. Instead, EqualsWithDelta should be used.

  • Custom User Avatar

    Approved.

  • Custom User Avatar

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

  • Custom User Avatar
  • Default User Avatar

    Updated, thanks!

    It appears that os.clock() doesn't account for time spent in sleep on Linux, but it does on Windows (Tested on both Ubuntu and Windows with Lua 5.3, 5.4 and LuaJIT). I've implemented a workaround timing function that reads /proc/uptime, which is more accurate than using os.time().

  • Default User Avatar

    approved

  • Custom User Avatar

    Looks nice!

  • Custom User Avatar

    There's so much in Python you'd have to disable to make this minimally difficult...

  • Custom User Avatar
  • Custom User Avatar

    Approved. Thanks!

  • Custom User Avatar

    If you fix the typo in the funtcion name in the description example, I'm happy with it.

    Testing frameworks generally do not foresee this usage. I think some other languages have to use bare asserts with custom messages. You managed nicely with what you had. :]

  • Custom User Avatar

    Approved.

    The comments in the random tests are really not necessary. The code is self-documenting; the comments just distract there.

    Please suppress the urge to code golf your test suite. join`` is just less readable than join("") - don't do it, write for readability and maintainability, CW can spare those couple of characters.

    I would have commented this directly on the translation, but CW would not let me. It also shows two comments it isn;t actually showing. Something's very wrong there.

  • Custom User Avatar

    I'm not worried about the encoding of "impossible"; -1 is as good as None, Nothing, null or whatever.

    I am worried about the failure messages of the random tests. There is ( still :[ ) enough confusion with the current failure messages; could

    For least_larger({2, -5, 7, -3, 8, -7, 2, 3, 7, -2, -4, -8, -9, 8, -8, -7, -6, -8, -4}, 2), the list of actual possible correct answers does not contain your answer:
    Expected: contains -1
    Actual: [ 4, 13 ]
    

    present -1 and [4,13] more clearly as actual and possible answers respectively? Using "Expected" and "Actual" with different meanings than in all other kata on CW seems like a bad idea. Yes, you may have to write custom assertions with custom messages. I would really appreciate if you stayed as close as possible to existing languages here; this point has been belaboured extensively here.

  • Loading more items...