making test_accuracy work as a function or a file