cpp test function code