Spitballing - we don't just want a mk_temp_file() and cleanup_temp_file() function if we can help it.. some kind of struct that handles this in the constructor/destructor to use RAII for cleanup. Something like this (untested)
struct TempFile {
explicit TempFile(std::string fileName, std::string contents) {
// make the file here
// Contents could be empty as well (second ctor?)
}
// cleanup
~TempFile() {}
// Other methods
bool compare_file(); // does the temp file match expected content
};