]> granicus.if.org Git - icinga2/blob - test/base-type.cpp
Fix cookie with ActivateItems
[icinga2] / test / base-type.cpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #include "base/perfdatavalue.hpp"
4 #include "base/dictionary.hpp"
5 #include "base/objectlock.hpp"
6 #include "base/application.hpp"
7 #include "base/type.hpp"
8 #include <BoostTestTargetConfig.h>
9
10 using namespace icinga;
11
12 BOOST_AUTO_TEST_SUITE(base_type)
13
14 BOOST_AUTO_TEST_CASE(gettype)
15 {
16         Type::Ptr t = Type::GetByName("Application");
17
18         BOOST_CHECK(t);
19 }
20
21 BOOST_AUTO_TEST_CASE(assign)
22 {
23         Type::Ptr t1 = Type::GetByName("Application");
24         Type::Ptr t2 = Type::GetByName("ConfigObject");
25
26         BOOST_CHECK(t1->IsAssignableFrom(t1));
27         BOOST_CHECK(t2->IsAssignableFrom(t1));
28         BOOST_CHECK(!t1->IsAssignableFrom(t2));
29 }
30
31 BOOST_AUTO_TEST_CASE(byname)
32 {
33         Type::Ptr t = Type::GetByName("Application");
34
35         BOOST_CHECK(t);
36 }
37
38 BOOST_AUTO_TEST_CASE(instantiate)
39 {
40         Type::Ptr t = Type::GetByName("PerfdataValue");
41
42         Object::Ptr p = t->Instantiate(std::vector<Value>());
43
44         BOOST_CHECK(p);
45 }
46
47 BOOST_AUTO_TEST_SUITE_END()