28 using namespace boost;
32 #include <boost/shared_ptr.hpp> 36 boost::shared_ptr<Marshalling>
marsh;
39 pl->loadTypekit(
"testtypes",
".;..");
40 marsh = tc->getProvider<
Marshalling>(
"marshalling");
52 boost::shared_ptr<Marshalling> marsh2 = tc->getProvider<
Marshalling>(
"marshalling");
53 BOOST_REQUIRE( marsh );
54 BOOST_REQUIRE( marsh2 );
55 BOOST_CHECK( marsh->ready() );
56 BOOST_CHECK( marsh2->ready() );
62 typedef std::vector<std::vector<double> > MatrixType;
63 typedef std::vector<double> RowType;
64 MatrixType mx( 5, RowType(5,5.0));
65 MatrixType mxz( 5, RowType(5,0.0));
69 BOOST_CHECK_EQUAL( mx[0][0], 5.0);
70 BOOST_CHECK_EQUAL( mx[4][4], 5.0);
71 BOOST_CHECK_EQUAL( mx[0][2], 5.0);
72 BOOST_CHECK_EQUAL( mx[2][0], 5.0);
73 BOOST_CHECK_EQUAL( mx[3][3], 5.0);
75 tc->addProperty(
"mx", mx);
77 BOOST_CHECK( marsh->writeProperties(
"TestMarshallMatrix.cpf") );
80 BOOST_REQUIRE( marsh->readProperties(
"TestMarshallMatrix.cpf") );
81 BOOST_REQUIRE_EQUAL( mx.size(), 5);
82 BOOST_REQUIRE_EQUAL( mx[0].size(), 5);
84 BOOST_CHECK_EQUAL( mx[0][0], 5.0);
85 BOOST_CHECK_EQUAL( mx[4][4], 5.0);
86 BOOST_CHECK_EQUAL( mx[0][2], 5.0);
87 BOOST_CHECK_EQUAL( mx[2][0], 5.0);
88 BOOST_CHECK_EQUAL( mx[3][3], 5.0);
91 BOOST_CHECK( marsh->writeProperties(
"TestMarshallMatrix.cpf") );
94 BOOST_REQUIRE( marsh->readProperties(
"TestMarshallMatrix.cpf") );
96 BOOST_CHECK_EQUAL( mx[0][0], 5.0);
97 BOOST_CHECK_EQUAL( mx[4][4], 5.0);
98 BOOST_CHECK_EQUAL( mx[0][2], 5.0);
99 BOOST_CHECK_EQUAL( mx[2][0], 5.0);
100 BOOST_CHECK_EQUAL( mx[3][3], 5.0);
111 tc->addProperty(
"at", at);
113 BOOST_CHECK( marsh->storeProperties(
"TestMarshallAType.cpf") );
116 BOOST_REQUIRE( marsh->readProperties(
"TestMarshallAType.cpf") );
118 BOOST_CHECK_EQUAL( at, atref);
121 BOOST_CHECK( marsh->writeProperties(
"TestMarshallAType.cpf") );
124 BOOST_REQUIRE( marsh->readProperties(
"TestMarshallAType.cpf") );
126 BOOST_CHECK_EQUAL( at, atref);
137 tc->addProperty(
"at", at);
139 BOOST_CHECK( marsh->storeProperties(
"TestMarshallBType.cpf") );
142 BOOST_REQUIRE( marsh->readProperties(
"TestMarshallBType.cpf") );
144 BOOST_CHECK_EQUAL( at, atref);
147 BOOST_CHECK( marsh->writeProperties(
"TestMarshallBType.cpf") );
150 BOOST_REQUIRE( marsh->readProperties(
"TestMarshallBType.cpf") );
152 BOOST_CHECK_EQUAL( at, atref);
163 tc->addProperty(
"at", at);
165 BOOST_CHECK( marsh->storeProperties(
"TestMarshallCType.cpf") );
168 BOOST_REQUIRE( marsh->readProperties(
"TestMarshallCType.cpf") );
170 BOOST_CHECK_EQUAL( at, atref);
173 BOOST_CHECK( marsh->writeProperties(
"TestMarshallCType.cpf") );
176 BOOST_REQUIRE( marsh->readProperties(
"TestMarshallCType.cpf") );
178 BOOST_CHECK_EQUAL( at, atref);
187 at.resize(5, init); atref.resize(5, init);
190 tc->addProperty(
"at", at);
192 BOOST_CHECK( marsh->storeProperties(
"TestMarshallATypes.cpf") );
195 BOOST_REQUIRE( marsh->readProperties(
"TestMarshallATypes.cpf") );
197 BOOST_CHECK_EQUAL( at, atref);
200 BOOST_CHECK( marsh->writeProperties(
"TestMarshallATypes.cpf") );
203 BOOST_REQUIRE( marsh->readProperties(
"TestMarshallATypes.cpf") );
205 BOOST_CHECK_EQUAL( at, atref);
214 at.resize(5,init); atref.resize(5,init);
217 tc->addProperty(
"at", at);
219 BOOST_CHECK( marsh->storeProperties(
"TestMarshallBTypes.cpf") );
222 BOOST_REQUIRE( marsh->readProperties(
"TestMarshallBTypes.cpf") );
224 BOOST_CHECK_EQUAL( at, atref);
227 BOOST_CHECK( marsh->writeProperties(
"TestMarshallBTypes.cpf") );
230 BOOST_REQUIRE( marsh->readProperties(
"TestMarshallBTypes.cpf") );
232 BOOST_CHECK_EQUAL( at, atref);
241 at.resize(5,init); atref.resize(5,init);
244 tc->addProperty(
"at", at);
246 BOOST_CHECK( marsh->storeProperties(
"TestMarshallCTypes.cpf") );
249 BOOST_REQUIRE( marsh->readProperties(
"TestMarshallCTypes.cpf") );
251 BOOST_CHECK_EQUAL( at, atref);
254 BOOST_CHECK( marsh->writeProperties(
"TestMarshallCTypes.cpf") );
257 BOOST_REQUIRE( marsh->readProperties(
"TestMarshallCTypes.cpf") );
259 BOOST_CHECK_EQUAL( at, atref);
#define BOOST_FIXTURE_TEST_SUITE(suite_name, F)
#define BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(TestGetProvider)
std::vector< BType > BTypes
std::vector< AType > ATypes
boost::shared_ptr< Marshalling > marsh
std::vector< CType > CTypes
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
boost::shared_ptr< PluginLoader > shared_ptr