From 9d73f0cf30d2e24ecb69f6bf61ad0d7c48230cfb Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Fri, 9 Nov 2018 14:56:36 +0100 Subject: [PATCH] Implement unit tests for Dictionary initializers --- test/CMakeLists.txt | 2 ++ test/base-dictionary.cpp | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 766d15a2e..c78f2732d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -73,6 +73,8 @@ add_boost_test(base base_convert/tostring base_convert/tobool base_dictionary/construct + base_dictionary/initializer1 + base_dictionary/initializer2 base_dictionary/get1 base_dictionary/get2 base_dictionary/foreach diff --git a/test/base-dictionary.cpp b/test/base-dictionary.cpp index 1eb5a1b7e..79d736f0a 100644 --- a/test/base-dictionary.cpp +++ b/test/base-dictionary.cpp @@ -32,6 +32,28 @@ BOOST_AUTO_TEST_CASE(construct) 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) { Dictionary::Ptr dictionary = new Dictionary(); -- 2.40.0