File: test_misc.hpp

package info (click to toggle)
quorum 1.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,092 kB
  • sloc: cpp: 21,390; perl: 201; makefile: 90; sh: 81
file content (19 lines) | stat: -rw-r--r-- 396 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef _TEST_MISC_H_
#define _TEST_MISC_H_

#include <unistd.h>

struct file_unlink {
  std::string path;
  bool do_unlink;
  explicit file_unlink(const char* s, bool d = true) : path(s), do_unlink(d) { }
  explicit file_unlink(const std::string& s, bool d = true) : path(s), do_unlink(d) { }

  ~file_unlink() {
    if(do_unlink)
      unlink(path.c_str());
  }
};


#endif /* _TEST_MISC_H_ */