tests: cpp: moved trivial test case to separate function