diff options
author | montellese <montellese@xbmc.org> | 2011-01-28 14:08:12 +0100 |
---|---|---|
committer | montellese <montellese@xbmc.org> | 2011-04-01 20:35:50 +0200 |
commit | 0158bd9ab97f4a4fa8d7770f4137905a3503b224 (patch) | |
tree | c457e66ff0e2eb2a7e2121e3e2d7719dfc8c73cc /lib/jsoncpp/src/test_lib_json/main.cpp | |
parent | 97b5e9f770405d37ce0f6ca95f538e80fefe18aa (diff) |
JSONRPC: update of jsoncpp library to latest revision
Diffstat (limited to 'lib/jsoncpp/src/test_lib_json/main.cpp')
-rw-r--r-- | lib/jsoncpp/src/test_lib_json/main.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/jsoncpp/src/test_lib_json/main.cpp b/lib/jsoncpp/src/test_lib_json/main.cpp index b80776d630..de64200ce7 100644 --- a/lib/jsoncpp/src/test_lib_json/main.cpp +++ b/lib/jsoncpp/src/test_lib_json/main.cpp @@ -1,3 +1,8 @@ +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + #include <json/json.h> #include "jsontest.h" @@ -23,6 +28,7 @@ struct ValueTest : JsonTest::TestCase Json::Value unsignedInteger_; Json::Value smallUnsignedInteger_; Json::Value real_; + Json::Value float_; Json::Value array1_; Json::Value object1_; Json::Value emptyString_; @@ -38,6 +44,7 @@ struct ValueTest : JsonTest::TestCase , smallUnsignedInteger_( Json::Value::UInt( Json::Value::maxInt ) ) , unsignedInteger_( 34567890u ) , real_( 1234.56789 ) + , float_( 0.00390625f ) , emptyString_( "" ) , string1_( "a" ) , string_( "sometext with space" ) @@ -167,6 +174,23 @@ JSONTEST_FIXTURE( ValueTest, isUInt ) } +JSONTEST_FIXTURE( ValueTest, accessArray ) +{ + const unsigned int index0 = 0; + JSONTEST_ASSERT( Json::Value(1234) == array1_[index0] ) << "Json::Value::operator[ArrayIndex]"; + JSONTEST_ASSERT( Json::Value(1234) == array1_[0] ) << "Json::Value::operator[int]"; + + const Json::Value &constArray = array1_; + JSONTEST_ASSERT( Json::Value(1234) == constArray[index0] ) << "Json::Value::operator[ArrayIndex] const"; + JSONTEST_ASSERT( Json::Value(1234) == constArray[0] ) << "Json::Value::operator[int] const"; +} + + +JSONTEST_FIXTURE( ValueTest, asFloat ) +{ + JSONTEST_ASSERT_EQUAL( 0.00390625f, float_.asFloat() ) << "Json::Value::asFloat()"; +} + void ValueTest::checkConstMemberCount( const Json::Value &value, unsigned int expectedCount ) { @@ -240,5 +264,8 @@ int main( int argc, const char *argv[] ) JSONTEST_REGISTER_FIXTURE( runner, ValueTest, isDouble ); JSONTEST_REGISTER_FIXTURE( runner, ValueTest, isString ); JSONTEST_REGISTER_FIXTURE( runner, ValueTest, isNull ); + JSONTEST_REGISTER_FIXTURE( runner, ValueTest, isNull ); + JSONTEST_REGISTER_FIXTURE( runner, ValueTest, accessArray ); + JSONTEST_REGISTER_FIXTURE( runner, ValueTest, asFloat ); return runner.runCommandLine( argc, argv ); } |