Tests restructure

this restructures the tests directory like so:

```
tests/
    data          # test data (indexes, packages etc...)
    unit           #  unit tests organized by module
    functional  # functional tests organized by subcommand
    lib             # support code for tests
    scripts      # miscellaneous test scripts
```