Refactored code for tests

The 'tests' package now contains modules implementing subclasses of BaseTest,
which defines the necessary structure for running tests. New test types can
be added by subclassing BaseTest and including arbitrary testing code.