ultimatepp/autotest/ConvertOverflow/ConvertOverflow.cpp
cxl d02fe7d7c7 Creating the *real* autotest nest
git-svn-id: svn://ultimatepp.org/upp/trunk@7141 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2014-04-02 18:36:01 +00:00

16 lines
448 B
C++

#include <Core/Core.h>
using namespace Upp;
#define CHECK_OVERFLOW(s, cls, overflow) { cls x; Value v = x.Scan(s); LOG(s << " -> " << v); ASSERT(v.IsError() == overflow); }
CONSOLE_APP_MAIN
{
StdLogSetup(LOG_FILE|LOG_COUT);
CHECK_OVERFLOW("2147483647", ConvertInt, false);
CHECK_OVERFLOW("2147483648", ConvertInt, true);
CHECK_OVERFLOW("-2147483647", ConvertInt, false);
CHECK_OVERFLOW("-2147483648", ConvertInt, true);
}