added C++ reference code for tests
fixed typos