Add basic tests

We add some basic tests and change the print_table method so that it
becomes easier to test.