News for hackers. Stuff that matters.
Re:Write A Function To Determine If A Number Is A Power Of 2 by qixxiq on Monday October 18, 2010 @01:06PM (#1804252)
My only problem is the seven lines of test cases at the bottom.

I'm not against testing, but I find many people using testing that excessively, start using it as an excuse not to bother thinking about if their solutions are correct or not.

Re:Write A Function To Determine If A Number Is A Power Of 2 by philwelch on Monday October 18, 2010 @01:34PM (#1804378)
If you're writing seven lines of test cases and just running your solution through the interpreter/compiler without thinking, sure. If you're writing seven lines of test cases and glancing back over to them as you write the solution it's a tool to help you think about whether your solutions are correct or not. In an interview/whiteboard environment you're going to be closer to the latter, if only because you're not going to have an interpreter at hand.