diff options
author | Andrew Stitcher <astitcher@apache.org> | 2013-05-08 17:37:34 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2013-05-08 17:37:34 +0000 |
commit | ccf2ee09ecdf14fffe84a815b2e88572707e9cc4 (patch) | |
tree | ef497159a145942ed4aa8e1fe1fa7d3e82dc2a8d /qpid/cpp/src/tests/Variant.cpp | |
parent | 44f7fb8aa3039369636862dac8a84d16f45138ee (diff) | |
download | qpid-python-ccf2ee09ecdf14fffe84a815b2e88572707e9cc4.tar.gz |
QPID-4822: Allow Variant::parse() to produce VAR_UINT64 types.
- Extend qpid::messaging::Variant string parser to output unsigned 64 bit
type where relevant (positive integer larger than signed 64 bits)
- Added some unit tests for the qpid::messageing::Variant string parser
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1480376 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/Variant.cpp')
-rw-r--r-- | qpid/cpp/src/tests/Variant.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/Variant.cpp b/qpid/cpp/src/tests/Variant.cpp index 6d629bbb4a..d2394bfbad 100644 --- a/qpid/cpp/src/tests/Variant.cpp +++ b/qpid/cpp/src/tests/Variant.cpp @@ -780,6 +780,33 @@ QPID_AUTO_TEST_CASE(testBufferEncoding) BOOST_CHECK_THROW(MapCodec::encode(inMap, buffer), std::exception); } +QPID_AUTO_TEST_CASE(parse) +{ + Variant a; + a.parse("What a fine mess"); + BOOST_CHECK(a.getType()==types::VAR_STRING); + a.parse("true"); + BOOST_CHECK(a.getType()==types::VAR_BOOL); + a.parse("FalsE"); + BOOST_CHECK(a.getType()==types::VAR_BOOL); + a.parse("3.1415926"); + BOOST_CHECK(a.getType()==types::VAR_DOUBLE); + a.parse("-7.2e-15"); + BOOST_CHECK(a.getType()==types::VAR_DOUBLE); + a.parse("9223372036854775807"); + BOOST_CHECK(a.getType()==types::VAR_INT64); + a.parse("9223372036854775808"); + BOOST_CHECK(a.getType()==types::VAR_UINT64); + a.parse("-9223372036854775807"); + BOOST_CHECK(a.getType()==types::VAR_INT64); + a.parse("-9223372036854775808"); + BOOST_CHECK(a.getType()==types::VAR_DOUBLE); + a.parse("18446744073709551615"); + BOOST_CHECK(a.getType()==types::VAR_UINT64); + a.parse("18446744073709551616"); + BOOST_CHECK(a.getType()==types::VAR_DOUBLE); +} + QPID_AUTO_TEST_SUITE_END() }} // namespace qpid::tests |