mirror of https://github.com/Icinga/icinga2.git
Implement unit tests for Dictionary initializers
This commit is contained in:
parent
3fa9c1d8dd
commit
9d73f0cf30
|
@ -73,6 +73,8 @@ add_boost_test(base
|
||||||
base_convert/tostring
|
base_convert/tostring
|
||||||
base_convert/tobool
|
base_convert/tobool
|
||||||
base_dictionary/construct
|
base_dictionary/construct
|
||||||
|
base_dictionary/initializer1
|
||||||
|
base_dictionary/initializer2
|
||||||
base_dictionary/get1
|
base_dictionary/get1
|
||||||
base_dictionary/get2
|
base_dictionary/get2
|
||||||
base_dictionary/foreach
|
base_dictionary/foreach
|
||||||
|
|
|
@ -32,6 +32,28 @@ BOOST_AUTO_TEST_CASE(construct)
|
||||||
BOOST_CHECK(dictionary);
|
BOOST_CHECK(dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(initializer1)
|
||||||
|
{
|
||||||
|
DictionaryData dict;
|
||||||
|
|
||||||
|
dict.emplace_back("test1", "Gin-o-clock");
|
||||||
|
|
||||||
|
Dictionary::Ptr dictionary = new Dictionary(std::move(dict));
|
||||||
|
|
||||||
|
Value test1;
|
||||||
|
test1 = dictionary->Get("test1");
|
||||||
|
BOOST_CHECK(test1 == "Gin-o-clock");
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(initializer2)
|
||||||
|
{
|
||||||
|
Dictionary::Ptr dictionary = new Dictionary({ {"test1", "Gin-for-the-win"} });
|
||||||
|
|
||||||
|
Value test1;
|
||||||
|
test1 = dictionary->Get("test1");
|
||||||
|
BOOST_CHECK(test1 == "Gin-for-the-win");
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(get1)
|
BOOST_AUTO_TEST_CASE(get1)
|
||||||
{
|
{
|
||||||
Dictionary::Ptr dictionary = new Dictionary();
|
Dictionary::Ptr dictionary = new Dictionary();
|
||||||
|
|
Loading…
Reference in New Issue