Fix the cpp unit tests to work correctly - includes some OSX tweaks