C++ version of Python test