Refactored cg_test to run over whole image.
Refactored cg_test to run over whole image.

General cleanup of test program structure.

Former-commit-id: 9d213fb83480072fdd4500e98e9c45ae5df78b13
Trass3r/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide,darkbuck/Halide,darkbuck/Halide,darkbuck/Halide,darkbuck/Halide,Trass3r/Halide,Trass3r/Halide,darkbuck/Halide