convert bug dir to unit tests. add unit test for csv output