aboutsummaryrefslogtreecommitdiff
path: root/src/test/serialize_tests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/serialize_tests.cpp')
-rw-r--r--src/test/serialize_tests.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp
index afcdd118bc..415f957811 100644
--- a/src/test/serialize_tests.cpp
+++ b/src/test/serialize_tests.cpp
@@ -61,9 +61,16 @@ BOOST_AUTO_TEST_CASE(compactsize)
static bool isCanonicalException(const std::ios_base::failure& ex)
{
- return std::string("non-canonical ReadCompactSize()") == ex.what();
+ std::ios_base::failure expectedException("non-canonical ReadCompactSize()");
+
+ // The string returned by what() can be different for different platforms.
+ // Instead of directly comparing the ex.what() with an expected string,
+ // create an instance of exception to see if ex.what() matches
+ // the expected explanatory string returned by the exception instance.
+ return strcmp(expectedException.what(), ex.what()) == 0;
}
+
BOOST_AUTO_TEST_CASE(noncanonical)
{
// Write some non-canonical CompactSize encodings, and