Add test for printf() by swapping cout streambuf

Also clean up some other tests by using CHECK_EQUAL rather than assert()