osrm-backend/test/include/testcase.hpp
Michael Krasnyk 68019a1fb2 Squashed 'third_party/protozero/' content from commit d5d8debf1
git-subtree-dir: third_party/protozero
git-subtree-split: d5d8debf1b17c6bb652395957b76cde7787e5377
2018-04-19 22:03:49 +03:00

22 lines
411 B
C++

#ifndef TESTCASE_HPP
#define TESTCASE_HPP
#include <cassert>
#include <fstream>
#include <limits>
#include <string>
template <class T>
std::string write_to_file(const T& msg, const char* filename) {
std::string out;
msg.SerializeToString(&out);
std::ofstream d{filename, std::ios_base::out|std::ios_base::binary};
assert(d.is_open());
d << out;
return out;
}
#endif // TESTCASE_HPP