[Mockpp-commits] mockpp/mockpp/tests Formatter_test.cpp,1.40,1.41
Brought to you by:
ewald-arnold
From: Ewald A. <ewa...@us...> - 2006-03-06 19:21:42
|
Update of /cvsroot/mockpp/mockpp/mockpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17949/mockpp/tests Modified Files: Formatter_test.cpp Log Message: fix for 64bit platforms Index: Formatter_test.cpp =================================================================== RCS file: /cvsroot/mockpp/mockpp/mockpp/tests/Formatter_test.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- Formatter_test.cpp 6 Jan 2006 16:02:34 -0000 1.40 +++ Formatter_test.cpp 6 Mar 2006 19:21:34 -0000 1.41 @@ -29,6 +29,7 @@ #include <mockpp/mockpp.h> // always first #include <cstdio> +#include <iostream> #include "SelectFramework.h" @@ -292,7 +293,9 @@ long ul = INT_MIN; #endif - mockpp::String str = mockpp::number(ul); // base 10 + mockpp::String str = mockpp::number((long)123, 16); + + str = mockpp::number(ul); // base 10 char buff[100]; #ifdef HAVE_SPRINTF_S sprintf_s(buff, "%ld", ul ); @@ -313,30 +316,32 @@ void Formatter_test::test_number_min_long_hex() { #ifdef HAVE_LIMITS - long ul = std::numeric_limits<long>::min(); + long long ull = std::numeric_limits<long long>::min(); #else - long ul = INT_MIN; + long long ull = INT_MIN; #endif - mockpp::String str = mockpp::number(ul, 16); - MOCKPP_ASSERT_EQUALS(MOCKPP_PCSTRING("-80000000"), str); // differs from sprintf(..) + mockpp::String str = mockpp::number((unsigned long)123, 16); + str = mockpp::number(ull, 16); + std::cout << mockpp::getLatin1(str).c_str() << std::endl; + MOCKPP_ASSERT_EQUALS(MOCKPP_PCSTRING("-8000000000000000"), str); // differs from sprintf(..) } void Formatter_test::test_number_max_long_dec() { #ifdef HAVE_LIMITS - long ul = std::numeric_limits<long>::max(); + long long ul = std::numeric_limits<long long>::max(); #else - long ul = INT_MAX; + long long ul = INT_MAX; #endif mockpp::String str = mockpp::number(ul); // base 10 char buff[100]; #ifdef HAVE_SPRINTF_S - sprintf_s(buff, "%ld", ul ); + sprintf_s(buff, "%lld", ul ); #else - std::sprintf(buff, "%ld", ul ); + std::sprintf(buff, "%lld", ul ); #endif #ifdef MOCKPP_UNICODE @@ -352,17 +357,17 @@ void Formatter_test::test_number_max_ulong_dec() { #ifdef HAVE_LIMITS - unsigned long ul = std::numeric_limits<unsigned long>::max(); + unsigned long long ul = std::numeric_limits<unsigned long long>::max(); #else - unsigned long ul = UINT_MAX; + unsigned long long ul = UINT_MAX; #endif mockpp::String str = mockpp::number(ul); // base 10 char buff[100]; #ifdef HAVE_SPRINTF_S - sprintf_s(buff, "%lu", ul ); + sprintf_s(buff, "%llu", ul ); #else - std::sprintf(buff, "%lu", ul ); + std::sprintf(buff, "%llu", ul ); #endif #ifdef MOCKPP_UNICODE |