Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
made it a lot shorter though the speed is similar due to the fact that yours inserts the value which is slower
The random tests appear to be wrong for typescript as the LCD is not always selected:
ex.:
expected '(30,60)(48,60)(45,60)(40,60)(42,60)' to equal '(90,180)(144,180)(135,180)(120,180)(126,180)'
for TEST: 1,2,4,5,3,4,6,9,7,10, RES: 30,60,48,60,45,60,40,60,42,60
Time measurement confirms my hypothesis:
divisors1 4.6103479569997035
divisors3 4.21220756699995
divisors4 4.539421095999842
divisors5 3.7151190190002126
Insert is O(n) (because we have to shift every element after insertion point), so total runtime for list construction will be O(n*n), where n is number of factors. Sort, on the other hand, should be O(n*log(n)), which is asymptotically faster.
Good one! I'll compare the runtimes with mine.
Thanks for the replies and quick fix.
OK, got it now:-) Modified the random tests in TS. Thanks!
Read the OP ;-) It's the TS version.
If you run the TS version you'll find that the whole test block for the random tests is invisible, all the tests are run silently.
Where do you see an empty string at the beginning of
describe/it
?With an intentional fault and a console.log(n) at the beginning of the function I get:
` Log:
n = 261235
expected [ 126235, 2, 0 ] to deeply equal [ 1262356, 2, 0 ]`
It doesn't seem that something is eaten. That gives the tested "n", the expected output and the "got" output. Do you want something more?
That's not the point though, the point is that empty string as the first argument of
describe
/it
eats all the stdout outputs (console.log
), which is horrible for debugging.AFAIK for failed tests you should have something like this
expected [ 126235, 2, 0 ] to deeply equal [ 1262356, 2, 0 ]
.@g964
As usual, don't put empty string as the first arguments of
describe
/it
.I am using TypeScript. The code appears to pass all the basic tests, about 170, but it fails about 30 (random). Not sure why it fails, as no error log is displayed in the output, console log output is also not displayed for the "failed" tests. It would be great if log output could be displayed for all failed states.