From 3ef061467a75a09008a7c56b72a972ffc26b8548 Mon Sep 17 00:00:00 2001 From: Kasper Marstal <kaspermarstal@gmail.com> Date: Mon, 26 Oct 2015 13:10:48 +0100 Subject: [PATCH] BUG: Fix negate ComponentExist --- Modules/Core/Blueprints/src/elxBlueprint.cxx | 2 +- Testing/Unit/elxBluePrintTest.cxx | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Modules/Core/Blueprints/src/elxBlueprint.cxx b/Modules/Core/Blueprints/src/elxBlueprint.cxx index 15223014..451f0b73 100644 --- a/Modules/Core/Blueprints/src/elxBlueprint.cxx +++ b/Modules/Core/Blueprints/src/elxBlueprint.cxx @@ -75,7 +75,7 @@ bool Blueprint ::ComponentExist( ComponentIndexType index ) { - return boost::vertex( index, this->m_Graph ) == boost::graph_traits< GraphType >::null_vertex(); + return boost::vertex( index, this->m_Graph ) != boost::graph_traits< GraphType >::null_vertex(); } diff --git a/Testing/Unit/elxBluePrintTest.cxx b/Testing/Unit/elxBluePrintTest.cxx index a8400491..a6b3e810 100644 --- a/Testing/Unit/elxBluePrintTest.cxx +++ b/Testing/Unit/elxBluePrintTest.cxx @@ -2,8 +2,6 @@ #include "gtest/gtest.h" -#include "itkImage.h" - namespace elx { class BlueprintTest : public ::testing::Test { @@ -41,6 +39,7 @@ TEST_F( BlueprintTest, Get ) { BlueprintPointerType blueprint = Blueprint::New(); ComponentIndexType index = blueprint->AddComponent( parameterMap ); + EXPECT_EQ( Blueprint::ComponentIndexType(0), index ); ParameterMapType parameterMapTest; EXPECT_NO_THROW( parameterMapTest = blueprint->GetComponent( index ) ); @@ -57,7 +56,7 @@ TEST_F( BlueprintTest, Delete ) EXPECT_EQ( parameterMap["ComponentName"], parameterMapTest["ComponentName"] ); EXPECT_NO_THROW( blueprint->DeleteComponent( index ) ); - parameterMapTest = blueprint->GetComponent( index ); + EXPECT_ANY_THROW( parameterMapTest = blueprint->GetComponent( index ) ); } } // namespace elx -- GitLab