typekit_test.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: The SourceWorks Tue Sep 7 00:54:57 CEST 2010 typekit_test.cpp
3 
4  typekit_test.cpp - description
5  -------------------
6  begin : Tue September 07 2010
7  copyright : (C) 2010 The SourceWorks
8  email : peter@thesourceworks.com
9 
10  ***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 
19 
27 #include "unit.hpp"
28 
31 #include <types/Operators.hpp>
32 #include <types/OperatorTypes.hpp>
33 
35 
37 {
38 };
39 
40 // Registers the fixture into the 'registry'
41 BOOST_FIXTURE_TEST_SUITE( TypekitTestSuite, TypekitFixture )
42 
43 BOOST_AUTO_TEST_CASE( testVectorTypeInfo )
45 {
46  Types()->addType( new types::SequenceTypeInfo<std::vector<std::string> >("strings") );
47 #if 0 // not supported
48  Types()->addType( new types::SequenceTypeInfo<std::vector<bool> >("bools") );
49 #endif
50 
51  Types()->addType( new types::SequenceTypeInfo<std::vector<int> >("ints") );
52 }
53 
56 BOOST_AUTO_TEST_CASE( testComposeDecompose )
57 {
58  vector<string> names = Types()->getTypes();
59  for(vector<string>::iterator it = names.begin(); it != names.end(); ++it) {
60  TypeInfo* ti = Types()->type(*it);
61  BOOST_REQUIRE(ti);
62  // might return null in case of void:
63  PropertyBase* input = ti->buildProperty("A","B");
64  PropertyBase* output = ti->buildProperty("C","D");
65  // if it's decomposable, compose it as well.
66  if ( input && output && ti->decomposeType(input->getDataSource()) ) {
67  BOOST_CHECK_MESSAGE( ti->composeType( ti->decomposeType(input->getDataSource()), output->getDataSource()), "Decomposition/Composition of " + *it + " failed!" );
68  }
69  }
70 }
71 
#define BOOST_FIXTURE_TEST_SUITE(suite_name, F)
bool composeType(base::DataSourceBase::shared_ptr source, base::DataSourceBase::shared_ptr target) const
Definition: TypeInfo.hpp:386
#define BOOST_AUTO_TEST_SUITE_END()
base::PropertyBase * buildProperty(const std::string &name, const std::string &desc, base::DataSourceBase::shared_ptr source=0) const
Definition: TypeInfo.hpp:214
TypeInfoRepository::shared_ptr Types()
Definition: Types.cpp:48
base::DataSourceBase::shared_ptr decomposeType(base::DataSourceBase::shared_ptr source) const
Definition: TypeInfo.hpp:402
BOOST_AUTO_TEST_CASE(testVectorTypeInfo)
Tests the SequenceTypeInfo class.
virtual DataSourceBase::shared_ptr getDataSource() const =0


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:45