Fixed compilation issues with MSVC 6: replace usage of ostringstream with valueToString to support 64 bits integer and high precision floating point conversion to string. Replace usage of ULL and LL literal with UInt64(expr) and Int64(expr). Introduced helper function uint64ToDouble() to work-around missing conversion. Unit tests do not pass yet.

This commit is contained in:
Baptiste Lepilleur
2011-05-26 22:55:24 +00:00
parent f0b24e705f
commit f587e6a420
4 changed files with 111 additions and 67 deletions

View File

@@ -8,6 +8,7 @@
# include <json/config.h>
# include <json/value.h>
# include <json/writer.h>
# include <stdio.h>
# include <deque>
# include <sstream>
@@ -90,14 +91,17 @@ namespace JsonTest {
template <typename T>
TestResult &operator << ( const T& value ) {
std::ostringstream oss;
oss.precision( 16 );
oss.setf( std::ios_base::floatfield );
oss << value;
return addToLastFailure(oss.str());
}
// Specialized versions.
TestResult &operator << ( bool value ) {
return addToLastFailure(value ? "true" : "false");
}
TestResult &operator << ( bool value );
// std:ostream does not support 64bits integers on all STL implementation
TestResult &operator << ( Json::Int64 value );
TestResult &operator << ( Json::UInt64 value );
private:
TestResult &addToLastFailure( const std::string &message );
@@ -195,6 +199,7 @@ namespace JsonTest {
return result;
}
TestResult &
checkStringEqual( TestResult &result,
const std::string &expected, const std::string &actual,