From 3a8e7405a6d5d7597b7d351955f33a5b1989ab8f Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Tue, 29 May 2012 06:25:01 +0200 Subject: [PATCH] Updated Dictionary tests. --- test/base-dictionary.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/test/base-dictionary.cpp b/test/base-dictionary.cpp index 62b8012d2..071e745ee 100644 --- a/test/base-dictionary.cpp +++ b/test/base-dictionary.cpp @@ -11,7 +11,7 @@ BOOST_AUTO_TEST_CASE(construct) BOOST_REQUIRE(dictionary); } -BOOST_AUTO_TEST_CASE(setproperty) +BOOST_AUTO_TEST_CASE(getproperty) { Dictionary::Ptr dictionary = make_shared(); dictionary->SetProperty("test1", 7); @@ -24,4 +24,32 @@ BOOST_AUTO_TEST_CASE(setproperty) string test2; BOOST_REQUIRE(dictionary->GetProperty("test2", &test2)); BOOST_REQUIRE(test2 == "hello world"); + + long test3; + BOOST_REQUIRE(!dictionary->GetProperty("test3", &test3)); +} + +BOOST_AUTO_TEST_CASE(getproperty_dict) +{ + Dictionary::Ptr dictionary = make_shared(); + Dictionary::Ptr other = make_shared(); + + dictionary->SetProperty("test1", other); + + Dictionary::Ptr test1; + BOOST_REQUIRE(dictionary->GetProperty("test1", &test1)); + BOOST_REQUIRE(other == test1); + + Dictionary::Ptr test2; + BOOST_REQUIRE(!dictionary->GetProperty("test2", &test2)); +} + +BOOST_AUTO_TEST_CASE(unnamed) +{ + Dictionary::Ptr dictionary = make_shared(); + dictionary->AddUnnamedProperty("test1"); + dictionary->AddUnnamedProperty("test2"); + dictionary->AddUnnamedProperty("test3"); + + BOOST_REQUIRE(distance(dictionary->Begin(), dictionary->End()) == 3); } -- 2.50.1