/* AccessCasted(Test) - verify helper to cast or convert as appropriate Copyright (C) Lumiera.org 2008, Hermann Vosseler 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., 675 Mass Ave, Cambridge, MA 02139, USA. * *****************************************************/ #include "lib/test/run.hpp" #include "lib/test/test-helper.hpp" #include "lib/access-casted.hpp" #include #include #include using std::move; using std::string; using std::ostream; using std::cout; using std::endl; using lumiera::error::LUMIERA_ERROR_BOTTOM_VALUE; namespace util { namespace test { namespace { // Test fixture... struct B {}; struct D : B {}; struct E : D { virtual ~E() {}; }; struct F : E {}; using lib::test::tyAbbr; ostream& operator<< (ostream& s, const B& b) { return s << "B{} adr="<<&b<<" type: "< = " << can_downcast::value < = " << can_downcast::value < = " << can_downcast::value < = " << can_downcast::value < = " << can_downcast::value < = " << can_downcast::value < = " << can_downcast::value < = " << can_downcast::value < = " << can_downcast::value < = " << has_RTTI::value < = " << has_RTTI::value < = " << has_RTTI::value < = " << std::is_convertible::value < = " << std::is_convertible::value < = " << can_use_dynamic_downcast::value < = " << can_use_conversion::value < = " << can_use_dynamic_downcast::value < = " << can_use_conversion::value < = " << can_use_dynamic_downcast::value < = " << can_use_conversion::value < = " << can_use_conversion::value < = " << can_use_dynamic_downcast::value <" << AccessCasted::access(d) <" << AccessCasted::access(rD) <" << AccessCasted::access(d) <" << AccessCasted::access(rD) <" << AccessCasted::access(move(dd1)) <" << AccessCasted::access(d) <" << AccessCasted::access(rD) <" << AccessCasted::access(pD) <" << AccessCasted::access(pD) <" << AccessCasted::access(move(pdd1)) <::access(pNull)); cout << "=== const correctness ==="<" << AccessCasted::access(d) <" << AccessCasted::access(rD) <" << AccessCasted::access(d) <" << AccessCasted::access(rD) <" << AccessCasted::access(d) <" << AccessCasted::access(rD) <" << AccessCasted::access(pD) <" << AccessCasted::access(pD) <" << AccessCasted::access(cD) <" << AccessCasted::access(rcD) <" << AccessCasted::access(cD) <" << AccessCasted::access(rcD) <" << AccessCasted::access(cD) <" << AccessCasted::access(rcD) <" << AccessCasted::access(pcD) <" << AccessCasted::access(pcD) <" << AccessCasted::access(rB) <" << AccessCasted::access(pD) <" << AccessCasted::access(pB) <" << AccessCasted::access(rpD) <" << AccessCasted::access(rpB) <" << AccessCasted::access(d) <" << AccessCasted::access(rD) <" << AccessCasted::access(rB) <" << AccessCasted::access(pD) <" << AccessCasted::access(pB) <" << AccessCasted::access(rpD) <" << AccessCasted::access(rpB) <" << AccessCasted::access(d) <" << AccessCasted::access(rE) <" << AccessCasted::access(pDE) <" << AccessCasted::access(pDE) <" << AccessCasted::access(pE) <