/* KLayout Layout Viewer Copyright (C) 2006-2017 Matthias Koefferlein This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include "tlUtils.h" #include "utHead.h" namespace { class A { }; class B : public A { }; class D : public B { }; class C : public A { }; class E { }; } struct XXX { int a, b; }; class XX : public XXX, private tl::Object { }; TEST(1) { EXPECT_EQ (tl::value_from_type (tl::type_from_value::value ()), false); EXPECT_EQ (tl::value_from_type (tl::type_from_value::value ()), true); EXPECT_EQ (tl::value_from_type (tl::is_derived::value ()), true); EXPECT_EQ (tl::value_from_type (tl::is_derived::value ()), false); EXPECT_EQ (tl::value_from_type (tl::is_derived::value ()), true); EXPECT_EQ (tl::value_from_type (tl::is_derived::value ()), true); EXPECT_EQ (tl::value_from_type (tl::is_derived::value ()), true); EXPECT_EQ (tl::value_from_type (tl::is_derived::value ()), false); EXPECT_EQ (bool (tl::is_derived ()), true); EXPECT_EQ (bool (tl::is_derived ()), false); EXPECT_EQ (tl::value_from_type (tl::is_equal_type::value ()), false); EXPECT_EQ (tl::value_from_type (tl::is_equal_type::value ()), true); EXPECT_EQ (bool (tl::is_equal_type ()), false); EXPECT_EQ (bool (tl::is_equal_type ()), true); A a; B b; C c; EXPECT_EQ (tl::try_static_cast (&a) == &a, true); EXPECT_EQ (tl::try_static_cast (&b) == (A *)&b, true); EXPECT_EQ (tl::try_static_cast (&c) == (A *)&c, true); EXPECT_EQ (tl::try_static_cast (&c) == 0, true); }