typekit_test.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002   tag: The SourceWorks  Tue Sep 7 00:54:57 CEST 2010  typekit_test.cpp
00003 
00004                         typekit_test.cpp -  description
00005                            -------------------
00006     begin                : Tue September 07 2010
00007     copyright            : (C) 2010 The SourceWorks
00008     email                : peter@thesourceworks.com
00009 
00010  ***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
00016  *                                                                         *
00017  ***************************************************************************/
00018 
00019 
00027 #include "unit.hpp"
00028 
00029 #include <types/TemplateTypeInfo.hpp>
00030 #include <types/TemplateConstructor.hpp>
00031 #include <types/Operators.hpp>
00032 #include <types/OperatorTypes.hpp>
00033 
00034 #include <types/SequenceTypeInfo.hpp>
00035 
00036 struct TypekitFixture
00037 {
00038 };
00039 
00040 // Registers the fixture into the 'registry'
00041 BOOST_FIXTURE_TEST_SUITE( TypekitTestSuite, TypekitFixture )
00042 
00043 
00044 BOOST_AUTO_TEST_CASE( testVectorTypeInfo )
00045 {
00046     Types()->addType( new types::SequenceTypeInfo<std::vector<std::string> >("strings") );
00047 #if 0 // not supported
00048     Types()->addType( new types::SequenceTypeInfo<std::vector<bool> >("bools") );
00049 #endif
00050 
00051     Types()->addType( new types::SequenceTypeInfo<std::vector<int> >("ints") );
00052 }
00053 
00056 BOOST_AUTO_TEST_CASE( testComposeDecompose )
00057 {
00058     vector<string> names = Types()->getTypes();
00059     for(vector<string>::iterator it = names.begin(); it != names.end(); ++it) {
00060         TypeInfo* ti = Types()->type(*it);
00061         BOOST_REQUIRE(ti);
00062         // might return null in case of void:
00063         PropertyBase* input = ti->buildProperty("A","B");
00064         PropertyBase* output = ti->buildProperty("C","D");
00065         // if it's decomposable, compose it as well.
00066         if ( input && output && ti->decomposeType(input->getDataSource()) ) {
00067             BOOST_CHECK_MESSAGE( ti->composeType( ti->decomposeType(input->getDataSource()), output->getDataSource()), "Decomposition/Composition of " + *it + " failed!" );
00068         }
00069     }
00070 }
00071 
00072 BOOST_AUTO_TEST_SUITE_END()


rtt
Author(s): RTT Developers
autogenerated on Sat Jun 8 2019 18:46:33