Add coverage to tests

This adds a coverage report to the tests. When run on Travis CI, it also sends the coverage report to Coverall.io, a free service for open source projects that shows a history of coverage and provides a badge.

For example:
https://coveralls.io/builds/692736

Todo:
1. First go to https://coveralls.io/repos/new and turn on this repo (you may need to click to sync first).
2. Then accept this PR (or if already accepted, trigger a new build).