Refactor cpp test of jenerator