diff options
author | Kangmo <kangmo@nanolat.com> | 2013-12-15 23:25:41 +0900 |
---|---|---|
committer | Kangmo <kangmo@nanolat.com> | 2013-12-15 23:25:41 +0900 |
commit | bccd5324ab5b76c21b01bfe9c8ec7ab2061c93e4 (patch) | |
tree | c17a1b7a4e8223cc6f96c0795c3ae12815129ae5 | |
parent | 8a7606f35bf6ce862996559d4860c9b7f618e9ee (diff) | |
download | bitcoin-bccd5324ab5b76c21b01bfe9c8ec7ab2061c93e4.tar.xz |
Fix unit test error on OSX 10.9 using Apple LLVM v5.0.
Before the fix, there were 6 errors such as :
serialize_tests.cpp:77: error in "noncanonical": incorrect exception std::ios_base::failure is caught
It turns out that ex.what() returns following string instead of "non-canonical ReadCompactSize()"
"non-canonical ReadCompactSize(): unspecified iostream_category error"
After the fix, unit test passed.
The test ran using Apple LLVM v5.0 on OSX 10.9 and the unit test error happened because of different error messages by different compilers.
g++ --version on my development environment.
```
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
```
-rw-r--r-- | src/test/serialize_tests.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp index afcdd118bc..885a91658d 100644 --- a/src/test/serialize_tests.cpp +++ b/src/test/serialize_tests.cpp @@ -61,9 +61,14 @@ BOOST_AUTO_TEST_CASE(compactsize) static bool isCanonicalException(const std::ios_base::failure& ex) { - return std::string("non-canonical ReadCompactSize()") == ex.what(); + std::string strExplanatoryString("non-canonical ReadCompactSize()"); + + return strExplanatoryString == ex.what() || + // OSX Apple LLVM version 5.0 (OSX 10.9) + strExplanatoryString + ": unspecified iostream_category error" == ex.what(); } + BOOST_AUTO_TEST_CASE(noncanonical) { // Write some non-canonical CompactSize encodings, and |