From ff9e51df7f98f743a8505b1991304cfae07184c3 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Fri, 12 Dec 2014 08:10:45 +0000 Subject: [PATCH] toString( int ) uses hex for large values now matches behaviour of unsigned int --- include/internal/catch_tostring.hpp | 5 ++++- projects/SelfTest/Baselines/console.sw.approved.txt | 2 +- projects/SelfTest/Baselines/xml.sw.approved.txt | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/internal/catch_tostring.hpp b/include/internal/catch_tostring.hpp index 21ee45f7..c4b3f152 100644 --- a/include/internal/catch_tostring.hpp +++ b/include/internal/catch_tostring.hpp @@ -98,7 +98,10 @@ std::string toString( wchar_t* const value ) std::string toString( int value ) { std::ostringstream oss; - oss << value; + if( value > 8192 ) + oss << "0x" << std::hex << value; + else + oss << value; return oss.str(); } diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 54b7c915..7f6be8ec 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -3398,7 +3398,7 @@ MiscTests.cpp:: PASSED: REQUIRE( Factorial(10) == 3628800 ) with expansion: - 0x == 3628800 + 0x == 0x ------------------------------------------------------------------------------- An empty test with no assertions diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 9a273fb6..612ed0bf 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -3519,7 +3519,7 @@ Factorial(10) == 3628800 - 0x == 3628800 + 0x == 0x