test/test_util.cc
branchENGINE-189
changeset 1656 ea7d229bed3f
child 1812 925ad845e3ec
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/test_util.cc	Mon Mar 13 20:20:10 2017 +0100
     1.3 @@ -0,0 +1,17 @@
     1.4 +#include "pEpEngine_test.h"
     1.5 +#include <fstream>
     1.6 +#include <sstream>
     1.7 +#include <stdexcept>
     1.8 +
     1.9 +std::string slurp(const std::string& filename)
    1.10 +{
    1.11 +	std::ifstream input(filename.c_str());
    1.12 +	if(!input)
    1.13 +	{
    1.14 +		throw std::runtime_error("Cannot read file \"" + filename + "\"! ");
    1.15 +	}
    1.16 +	
    1.17 +	std::stringstream sstr;
    1.18 +	sstr << input.rdbuf();
    1.19 +	return sstr.str();
    1.20 +}