Moved unit tests to tests/unit/.
Added error checking.