Commit 5849385c authored by Floris Berendsen's avatar Floris Berendsen
Browse files

ENH: adaped NetworkBuilderTest to refactoring

parent a6f9e70f
......@@ -44,15 +44,11 @@ public:
typedef Blueprint::ParameterMapType ParameterMapType;
typedef Blueprint::ParameterValueType ParameterValueType;
/** register all example components */
using CustomComponentList = TypeList<TransformComponent1, MetricComponent1, GDOptimizer3rdPartyComponent, GDOptimizer4thPartyComponent, SSDMetric3rdPartyComponent, SSDMetric4thPartyComponent>;
virtual void SetUp()
{
/** register all example components */
ComponentFactory< TransformComponent1 >::RegisterOneFactory();
ComponentFactory< MetricComponent1 >::RegisterOneFactory();
ComponentFactory< GDOptimizer3rdPartyComponent >::RegisterOneFactory();
ComponentFactory< GDOptimizer4thPartyComponent >::RegisterOneFactory();
ComponentFactory< SSDMetric3rdPartyComponent >::RegisterOneFactory();
ComponentFactory< SSDMetric4thPartyComponent >::RegisterOneFactory();
/** make example blueprint configuration */
blueprint = BlueprintPointer( new Blueprint( ) );
......@@ -74,7 +70,6 @@ public:
virtual void TearDown()
{
itk::ObjectFactoryBase::UnRegisterAllFactories();
}
......@@ -83,12 +78,13 @@ public:
TEST_F( NetworkBuilderTest, Create )
{
NetworkBuilderPointer networkBuilder = NetworkBuilderPointer( new NetworkBuilder<TypeList<>>( new Blueprint() ) );
NetworkBuilderPointer networkBuilderA = NetworkBuilderPointer(new NetworkBuilder<CustomComponentList>());
NetworkBuilderPointer networkBuilderB = NetworkBuilderPointer(new NetworkBuilder<CustomComponentList>(new Blueprint()));
}
TEST_F( NetworkBuilderTest, Configure )
{
NetworkBuilderPointer networkBuilder = NetworkBuilderPointer(new NetworkBuilder<TypeList<>>(blueprint));
NetworkBuilderPointer networkBuilder = NetworkBuilderPointer(new NetworkBuilder<CustomComponentList>(blueprint));
bool allUniqueComponents;
EXPECT_NO_THROW( allUniqueComponents = networkBuilder->Configure() );
EXPECT_TRUE( allUniqueComponents );
......@@ -96,7 +92,7 @@ TEST_F( NetworkBuilderTest, Configure )
TEST_F( NetworkBuilderTest, Connect )
{
std::unique_ptr< NetworkBuilderBase > networkBuilder(new NetworkBuilder<TypeList<>>(blueprint));
std::unique_ptr< NetworkBuilderBase > networkBuilder(new NetworkBuilder<CustomComponentList>(blueprint));
EXPECT_NO_THROW( bool allUniqueComponents = networkBuilder->Configure() );
bool success;
EXPECT_NO_THROW(success = networkBuilder->ConnectComponents());
......@@ -128,8 +124,6 @@ TEST_F( NetworkBuilderTest, DeduceComponentsFromConnections )
using RegisterComponents = list_append< DefaultComponents, CustomRegisterComponents >::type;
RegisterFactoriesByTypeList< RegisterComponents >::Register();
BlueprintPointer blueprint = BlueprintPointer( new Blueprint() ); // override old blueprint
blueprint->SetComponent( "RegistrationMethod", { { "NameOfClass", { "ItkImageRegistrationMethodv4Component" } },
......@@ -217,7 +211,7 @@ TEST_F( NetworkBuilderTest, DeduceComponentsFromConnections )
blueprint->SetConnection( "ResampleFilter", "Controller", { {} } ); //ReconnectTransformInterface
blueprint->SetConnection( "TransformDisplacementFilter", "Controller", { {} } ); //ReconnectTransformInterface
std::unique_ptr< NetworkBuilderBase > networkBuilder(new NetworkBuilder<CustomRegisterComponents>(blueprint));
std::unique_ptr< NetworkBuilderBase > networkBuilder(new NetworkBuilder<RegisterComponents>(blueprint));
bool allUniqueComponents;
EXPECT_NO_THROW(allUniqueComponents = networkBuilder->Configure());
EXPECT_TRUE( allUniqueComponents );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment