Kata premise is completely flawed: Why does partition(101, 50) expect [50, 51] only? [101] is also a valid result, since sqrt(2n)-(3minsize) is negative in this case.
partition(101, 50)
[50, 51]
[101]
sqrt(2n)-(3minsize)
Error messages are not very useful:
Has invalid result
Shouldn't use test.expect()
test.expect()
stated it explicitly in description now
corrected in description
I would definitively specify that the sum of the output should be the value.
sum
I really like it otherwise, short but pleasant.
test.expect(len(partition(50, 1)) >= 7, "length should be 7 at least")
According to the description, the list must be [strictly] longer that 7.
Loading collection data...
Kata premise is completely flawed: Why does
partition(101, 50)
expect[50, 51]
only?[101]
is also a valid result, sincesqrt(2n)-(3minsize)
is negative in this case.Error messages are not very useful:
Shouldn't use
test.expect()
stated it explicitly in description now
corrected in description
I would definitively specify that the
sum
of the output should be the value.I really like it otherwise, short but pleasant.
test.expect(len(partition(50, 1)) >= 7, "length should be 7 at least")
According to the description, the list must be [strictly] longer that 7.