Add more comprehensive unit testing

Add many tests to the unit tests, including FreeBSD and testing on
different architectures