Added new unit testing utility.

Refactored getopt.h for better testability.

Whitespace fixes.