Modified auto_test to remove dependence on globals.