Reorganize tests

- Reorganize test subdirectories
- Replace set_up_database() with DatabaseTestCase
- Move support code in LibraryTest to separate files
- Simplify support code inclusion in Makefile