Ad
  • Default User Avatar

    nope, not completely:

    you didn't correct the solution setup either (>>> primes not prime <<<)

    put the random tests in a closure (some readings upper there)

    And you should push further your requirement for the tests. I'd suggest:

    • 100 random tests (10 are not enough)
    • push the max value for primes to at least MAX_P = 10000 (talking about "usable" ones, meaning, that would be the upperbond for r2)
    • but change the way you determine the range, to avoid the generation of HUGE outputs: pick r1 randomly below MAX_P-2000, then define r2 with r2 = r1 + randrange(2000)
  • Default User Avatar

    note that you didn't correct the solution setup either.

  • Default User Avatar

    yes, but still some things to address:

    • you didn't describe the order in which the sequences have to been put in the output list

    • do NEVER put your solution in the preloaded part (EDIT: well, it seems actually that you didn't put anything in the preloaded part... Then how do you compute the reference solution??? See below ;p )

    • "typo" in the random tests:

        # compute the expected result
        expected = primes(r1,r2)
      
        # do the actual testing
        actual = primes(r1, r2)
      

    of course the two calls will return the exact same output, there, even if it's completely flawed!

    • test.assert_equals(actual, expected,"primes({}, {})".format(r1, r2)) => That's good, to put the input in the message. Though, using assert_equals, the whole lists will be displayed in case of failures: depending on there length, that might make crash the consol output. Did you try to make it fail on long ouptuts, to be sure that's good?
    • put the random tests in a closure (some readings here)
  • Default User Avatar

    seeing "the amount of work", you should maybe unpublish it in the meantime. ;)