Move the test directory to a proper place. Add the necesseray CMake bits to build tests. Quickly fix some minor coding style issues