Enhance test program and build it so it can be run from the command line