28 #include <boost/serialization/serialization.hpp> 29 #include <boost/filesystem.hpp> 36 namespace serializationTestHelpers {
46 boost::filesystem::path folder =
"actual") {
47 boost::filesystem::remove_all(folder);
48 boost::filesystem::create_directory(folder);
55 std::string serialized =
serialize(input);
56 if (
verbose) std::cout << serialized << std::endl << std::endl;
71 T output = create<T>(), outputf = create<T>();
72 roundtrip<T>(input,output);
73 roundtripFile<T>(input,outputf);
74 return (input==output) && (input==outputf);
80 T output = create<T>();
81 roundtrip<T>(input,output);
88 T output = create<T>();
89 roundtrip<T>(input,output);
90 return input->equals(*output);
96 std::string serialized = serializeXML<T>(input);
97 if (
verbose) std::cout << serialized << std::endl << std::endl;
112 T output = create<T>(), outputf = create<T>();
113 roundtripXML<T>(input,output);
114 roundtripXMLFile<T>(input,outputf);
115 return (input==output) && (input==outputf);
121 T output = create<T>();
122 roundtripXML<T>(input,output);
129 T output = create<T>();
130 roundtripXML<T>(input,output);
131 return input->equals(*output);
137 std::string serialized = serializeBinary<T>(input);
138 if (
verbose) std::cout << serialized << std::endl << std::endl;
153 T output = create<T>(), outputf = create<T>();
154 roundtripBinary<T>(input,output);
155 roundtripBinaryFile<T>(input,outputf);
156 return (input==output) && (input==outputf);
162 T output = create<T>();
163 roundtripBinary<T>(input,output);
170 T output = create<T>();
171 roundtripBinary<T>(input,output);
172 return input->equals(*output);
bool deserializeFromFile(const std::string &filename, T &output)
deserializes from a file
bool equalsDereferenced(const T &input)
void roundtripBinary(const T &input, T &output)
std::string serialize(const T &input)
serializes to a string
bool equalsDereferencedXML(const T &input=T())
bool equalsObj(const T &input=T())
void roundtrip(const T &input, T &output)
bool serializeToFile(const T &input, const std::string &filename)
serializes to a file
bool equalsDereferencedBinary(const T &input=T())
void roundtripFile(const T &input, T &output)
bool equalsXML(const T &input=T())
bool equalsBinary(const T &input=T())
void roundtripXML(const T &input, T &output)
void deserializeXML(const std::string &serialized, T &output, const std::string &name="data")
deserializes from a string in XML
bool equality(const T &input=T())
bool equalityBinary(const T &input=T())
bool serializeToBinaryFile(const T &input, const std::string &filename, const std::string &name="data")
serializes to a binary file
Eigen::Triplet< double > T
void roundtripXMLFile(const T &input, T &output)
void deserializeBinary(const std::string &serialized, T &output, const std::string &name="data")
deserializes from a string in binary
bool deserializeFromXMLFile(const std::string &filename, T &output, const std::string &name="data")
deserializes from an XML file
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
void deserialize(const std::string &serialized, T &output)
deserializes from a string
void roundtripBinaryFile(const T &input, T &output)
bool serializeToXMLFile(const T &input, const std::string &filename, const std::string &name="data")
serializes to an XML file
bool deserializeFromBinaryFile(const std::string &filename, T &output, const std::string &name="data")
deserializes from a binary file
bool equalityXML(const T &input=T())
boost::filesystem::path resetFilesystem(boost::filesystem::path folder="actual")