forked from lijiext/lammps
portability improvement. replace POSIX-only functionality.
This commit is contained in:
parent
e980d17882
commit
0aa64eaf14
|
@ -10,14 +10,12 @@
|
|||
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
#ifndef TEST_EXTENSIONS__H
|
||||
#define TEST_EXTENSIONS__H
|
||||
#ifndef LMP_TESTING_UTILS_H
|
||||
#define LMP_TESTING_UTILS_H
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <vector>
|
||||
|
||||
static void delete_file(const std::string &filename)
|
||||
|
@ -65,8 +63,8 @@ static std::vector<std::string> read_lines(const std::string &filename)
|
|||
|
||||
static bool file_exists(const std::string &filename)
|
||||
{
|
||||
struct stat result;
|
||||
return stat(filename.c_str(), &result) == 0;
|
||||
std::ifstream infile(filename);
|
||||
return infile.good();
|
||||
}
|
||||
|
||||
#define ASSERT_FILE_EXISTS(NAME) ASSERT_TRUE(file_exists(NAME))
|
||||
|
|
Loading…
Reference in New Issue