Skip to content

Commit 2a2b5cf

Browse files
committed
Made jsontest work with 64-bit integers, and fixed an error.
1 parent b6620e2 commit 2a2b5cf

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

src/test_lib_json/jsontest.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,25 @@ TestResult::operator << ( unsigned int value )
275275
}
276276

277277

278+
#ifdef JSON_HAS_INT64
279+
TestResult &
280+
TestResult::operator << ( Json::Int64 value )
281+
{
282+
char buffer[32];
283+
sprintf( buffer, "%lld", value );
284+
return addToLastFailure( buffer );
285+
}
286+
287+
TestResult &
288+
TestResult::operator << ( Json::UInt64 value )
289+
{
290+
char buffer[32];
291+
sprintf( buffer, "%ull", value );
292+
return addToLastFailure( buffer );
293+
}
294+
#endif
295+
296+
278297
TestResult &
279298
TestResult::operator << ( double value )
280299
{

src/test_lib_json/jsontest.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ namespace JsonTest {
8787
TestResult &operator << ( bool value );
8888
TestResult &operator << ( int value );
8989
TestResult &operator << ( unsigned int value );
90+
#ifdef JSON_HAS_INT64
91+
TestResult &operator << ( Json::Int64 value );
92+
TestResult &operator << ( Json::UInt64 value );
93+
#endif
9094
TestResult &operator << ( double value );
9195
TestResult &operator << ( const char *value );
9296
TestResult &operator << ( const std::string &value );
@@ -229,6 +233,7 @@ namespace JsonTest {
229233
#define JSONTEST_ASSERT_STRING_EQUAL( expected, actual ) \
230234
JsonTest::checkStringEqual( *result_, \
231235
std::string(expected), std::string(actual), \
236+
__FILE__, __LINE__, \
232237
#expected " == " #actual )
233238

234239
/// \brief Begin a fixture test case.

0 commit comments

Comments
 (0)