Skip to content
Snippets Groups Projects
Commit d48cd6e3 authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

added more tests for illegal network configurations

parent a39a1c51
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ template<typename T>
class TestModule : public ctk::ApplicationModule {
public:
SCALAR_ACCESSOR(T, feedingPush, ctk::VariableDirection::feeding, "MV/m", ctk::UpdateMode::push);
SCALAR_ACCESSOR(T, feedingPush2, ctk::VariableDirection::feeding, "MV/m", ctk::UpdateMode::push);
SCALAR_ACCESSOR(T, consumingPush, ctk::VariableDirection::consuming, "MV/m", ctk::UpdateMode::push);
SCALAR_ACCESSOR(T, consumingPush2, ctk::VariableDirection::consuming, "MV/m", ctk::UpdateMode::push);
SCALAR_ACCESSOR(T, consumingPush3, ctk::VariableDirection::consuming, "MV/m", ctk::UpdateMode::push);
......@@ -71,3 +72,57 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( testTwoScalarPollPushAccessors, T, test_types ) {
}
}
/*********************************************************************************************************************/
/* test case for no feeder */
BOOST_AUTO_TEST_CASE_TEMPLATE( testNoFeeder, T, test_types ) {
TestApplication app("Test Suite");
TestModule<T> testModule;
testModule.consumingPush2.connectTo(testModule.consumingPush);
try {
app.makeConnections();
BOOST_ERROR("Exception expected.");
}
catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalVariableNetwork> &e) {
}
}
/*********************************************************************************************************************/
/* test case for no consumer */
BOOST_AUTO_TEST_CASE_TEMPLATE( testNoConsumer, T, test_types ) {
TestApplication app("Test Suite");
TestModule<T> testModule;
try {
testModule.feedingPush.connectTo(testModule.feedingPush2);
BOOST_ERROR("Exception expected.");
}
catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalVariableNetwork> &e) {
}
}
/*********************************************************************************************************************/
/* test case for too many polling consumers */
BOOST_AUTO_TEST_CASE_TEMPLATE( testTooManyPollingConsumers, T, test_types ) {
TestApplication app("Test Suite");
TestModule<T> testModule;
testModule.feedingPoll.connectTo(testModule.consumingPoll);
testModule.feedingPoll.connectTo(testModule.consumingPoll2);
try {
app.makeConnections();
BOOST_ERROR("Exception expected.");
}
catch(ctk::ApplicationExceptionWithID<ctk::ApplicationExceptionID::illegalVariableNetwork> &e) {
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment