Add tests and documentation

To accomodate, the files were split out into a dedicated directory.