1 // Copyright (C) 2013-2020 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __XAO_TESTUTILS_HXX__
21 #define __XAO_TESTUTILS_HXX__
31 static std::string getTestFilePath(const std::string& filePath)
33 std::string dataDir = getenv("DATA_DIR");
38 static char* readTextFile(const std::string& filePath)
42 rstr.open(filePath.c_str(), std::ios_base::binary);
43 rstr.seekg(0, rstr.end); // go to the end
44 length = rstr.tellg(); // report location (this is the length)
45 rstr.seekg(0, rstr.beg); // go back to the beginning
46 char* txt = new char[length+1]; // allocate memory for a buffer of appropriate dimension
47 rstr.read(txt, length); // read the whole file into the buffer
56 #endif /* __XAO_TESTUTILS_HXX__ */