fixed unit test failure on `testSerializationBase`
object `output` was getting reused, but should be re-loaded into a "blank" object each time.release/4.3a0
parent
a4737d4706
commit
82db82bbf5
|
@ -44,8 +44,8 @@ T create() {
|
||||||
// Creates or empties a folder in the build folder and returns the relative path
|
// Creates or empties a folder in the build folder and returns the relative path
|
||||||
boost::filesystem::path resetFilesystem(
|
boost::filesystem::path resetFilesystem(
|
||||||
boost::filesystem::path folder = "actual") {
|
boost::filesystem::path folder = "actual") {
|
||||||
boost::filesystem::remove_all(folder);
|
// boost::filesystem::remove_all(folder);
|
||||||
boost::filesystem::create_directory(folder);
|
// boost::filesystem::create_directory(folder);
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,11 +71,10 @@ void roundtripFile(const T& input, T& output) {
|
||||||
// This version requires equality operator
|
// This version requires equality operator
|
||||||
template<class T>
|
template<class T>
|
||||||
bool equality(const T& input = T()) {
|
bool equality(const T& input = T()) {
|
||||||
T output = create<T>();
|
T output = create<T>(), outputf = create<T>();
|
||||||
roundtrip<T>(input,output);
|
roundtrip<T>(input,output);
|
||||||
if (input != output) return false;
|
roundtripFile<T>(input,outputf);
|
||||||
roundtripFile<T>(input,output);
|
return (input==output) && (input==outputf);
|
||||||
return input==output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This version requires Testable
|
// This version requires Testable
|
||||||
|
@ -89,11 +88,10 @@ bool equalsObj(const T& input = T()) {
|
||||||
// De-referenced version for pointers, requires equals method
|
// De-referenced version for pointers, requires equals method
|
||||||
template<class T>
|
template<class T>
|
||||||
bool equalsDereferenced(const T& input) {
|
bool equalsDereferenced(const T& input) {
|
||||||
T output = create<T>();
|
T output = create<T>(), outputf = create<T>();
|
||||||
roundtrip<T>(input,output);
|
roundtrip<T>(input,output);
|
||||||
if (!input->equals(*output)) return false;
|
roundtripFile<T>(input,outputf);
|
||||||
roundtripFile<T>(input,output);
|
return (input->equals(*output)) && (input->equals(*outputf));
|
||||||
return input->equals(*output);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Templated round-trip serialization using XML
|
// Templated round-trip serialization using XML
|
||||||
|
@ -122,11 +120,10 @@ void roundtripXMLFile(const T& input, T& output) {
|
||||||
// This version requires equality operator
|
// This version requires equality operator
|
||||||
template<class T>
|
template<class T>
|
||||||
bool equalityXML(const T& input = T()) {
|
bool equalityXML(const T& input = T()) {
|
||||||
T output = create<T>();
|
T output = create<T>(), outputf = create<T>();
|
||||||
roundtripXML<T>(input,output);
|
roundtripXML<T>(input,output);
|
||||||
if (input != output) return false;
|
roundtripXMLFile<T>(input,outputf);
|
||||||
roundtripXMLFile<T>(input,output);
|
return (input==output) && (input==outputf);
|
||||||
return input==output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This version requires Testable
|
// This version requires Testable
|
||||||
|
@ -140,11 +137,10 @@ bool equalsXML(const T& input = T()) {
|
||||||
// This version is for pointers, requires equals method
|
// This version is for pointers, requires equals method
|
||||||
template<class T>
|
template<class T>
|
||||||
bool equalsDereferencedXML(const T& input = T()) {
|
bool equalsDereferencedXML(const T& input = T()) {
|
||||||
T output = create<T>();
|
T output = create<T>(), outputf = create<T>();
|
||||||
roundtripXML<T>(input,output);
|
roundtripXML<T>(input,output);
|
||||||
if (!input->equals(*output)) return false;
|
roundtripXMLFile<T>(input, outputf);
|
||||||
roundtripXMLFile<T>(input, output);
|
return (input->equals(*output)) && (input->equals(*outputf));
|
||||||
return input->equals(*output);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Templated round-trip serialization using XML
|
// Templated round-trip serialization using XML
|
||||||
|
@ -171,11 +167,10 @@ void roundtripBinaryFile(const T& input, T& output) {
|
||||||
// This version requires equality operator
|
// This version requires equality operator
|
||||||
template<class T>
|
template<class T>
|
||||||
bool equalityBinary(const T& input = T()) {
|
bool equalityBinary(const T& input = T()) {
|
||||||
T output = create<T>();
|
T output = create<T>(), outputf = create<T>();
|
||||||
roundtripBinary<T>(input,output);
|
roundtripBinary<T>(input,output);
|
||||||
if (input != output) return false;
|
roundtripBinaryFile<T>(input,outputf);
|
||||||
roundtripBinaryFile<T>(input,output);
|
return (input==output) && (input==outputf);
|
||||||
return input==output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This version requires Testable
|
// This version requires Testable
|
||||||
|
@ -189,11 +184,10 @@ bool equalsBinary(const T& input = T()) {
|
||||||
// This version is for pointers, requires equals method
|
// This version is for pointers, requires equals method
|
||||||
template<class T>
|
template<class T>
|
||||||
bool equalsDereferencedBinary(const T& input = T()) {
|
bool equalsDereferencedBinary(const T& input = T()) {
|
||||||
T output = create<T>();
|
T output = create<T>(), outputf = create<T>();
|
||||||
roundtripBinary<T>(input,output);
|
roundtripBinary<T>(input,output);
|
||||||
if (!input->equals(*output)) return false;
|
roundtripBinaryFile<T>(input,outputf);
|
||||||
roundtripBinaryFile<T>(input,output);
|
return (input->equals(*output)) && (input->equals(*outputf));
|
||||||
return input->equals(*output);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // \namespace serializationTestHelpers
|
} // \namespace serializationTestHelpers
|
||||||
|
|
Loading…
Reference in New Issue