Hacker News new | ask | show | jobs
by jacquesm 3389 days ago
That's the equivalent of a 32 branch switch statement in one line.

So only 31 other cases to test for, now let's hope they did all those tests.

1 comments

I'm definitely not advocating for unnecessarily complex or long conditionals on a single line or any other hard-to-grok code, but this comment reminded me of something I just learned recently! Someone on my team introduced me to property-based testing, which generates ranges of test cases that would otherwise be very repetitive to write manually. We've used http://hypothesis.works/ in a few places recently and caught bugs that we might have missed if we had just written tests the usual way.
Were you using their python version or the Java one?