Ad
  • Default User Avatar

    Refactor random test:
    1.) move input and output inside the function
    2.) show input in test information

    For example:

    @test.describe("Random Tests")
    def tests():
        input, output = generate_test_array()
        for i in range(0,100):
            @test.it(f"input: {input[i]}")
            def test_tnt_order():
                    d = uniform(0.1,384400000)
                    test.assert_approx_equals(necessary_tons_of_tnt(input[i]),output[i], margin=1e-6)
    
  • Custom User Avatar

    It's not stated what to do with indices pointing at non-existing words.

  • Custom User Avatar

    Sample and fixed tests should use exact expected values instead of rounded to 5 decimal places ones.

  • Custom User Avatar

    The current precision requirement (1e-2) is so lenient that a simple approximation based on the two given test cases passes all tests. I suggest increasing the required precision to 1e-6, which should be easily reached with any solution based on the correctly derived closed-form solution.

  • Custom User Avatar

    Division seems to not be tested.

  • Custom User Avatar

    Since inputs seem to be simple polynomials, this kata seems to be a close duplicate of Differentiate a polynomial, with some additional mess in input strings.

  • Custom User Avatar
    • Saying "basic operators" doesn't really explain anything, x**x**x also consists of "basic operators" but calculating its derivative is far more involved than for, say, "x * 2"
    • "t" is not a mathematical operator
    • Initial solution is wrong
    • No sample tests
    • No random tests
    • The result should be tested for approximate equality instead

    With the current tests, this kata is practically a simple regex-replacement task which isn't really a novel idea.