added the function test() which tests with test cases and produces *.out
files