Refactor tests and add more tests

fixes #39 on github.

Make tests generally more DRY using helper methods
Factor out BOM insertion so that test data can look more natural and the adding of BOM strings can be done inside the test block.
Add tests for field_header_map, which was not under test.
Split tests into separate modules.
Add SQL-like functions for querying CSV data.