Add type casts for tests for C++ compile