diff --git a/unittest/testing/utils.h b/unittest/testing/utils.h index c76b37872a..730c6fdb44 100644 --- a/unittest/testing/utils.h +++ b/unittest/testing/utils.h @@ -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 #include #include -#include -#include #include static void delete_file(const std::string &filename) @@ -65,8 +63,8 @@ static std::vector 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))