From d4573dc10d54e76e85c6210f6398ead6c5d2ab7b Mon Sep 17 00:00:00 2001 From: Franziska Wegner Date: Tue, 2 Jan 2024 03:50:10 -0800 Subject: [PATCH] Check the remaining tests if it is PyPSA only --- tests/DataStructures/Graphs/TestPowerGrid.cpp | 6136 ++++++++--------- 1 file changed, 3068 insertions(+), 3068 deletions(-) diff --git a/tests/DataStructures/Graphs/TestPowerGrid.cpp b/tests/DataStructures/Graphs/TestPowerGrid.cpp index 46d4fb7c..117b0f5d 100644 --- a/tests/DataStructures/Graphs/TestPowerGrid.cpp +++ b/tests/DataStructures/Graphs/TestPowerGrid.cpp @@ -1906,63 +1906,63 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // EXPECT_EQ ( 2, generatorIds.size() ); // } -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark GeneratorAt -// // *********************************************************************** -// // *********************************************************************** +// *********************************************************************** +// *********************************************************************** +#pragma mark GeneratorAt +// *********************************************************************** +// *********************************************************************** -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , GeneratorAt ) -// { -// // Generator does not exist -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "GeneratorAt" -// , R"(HasGenerator \( generatorId \))"); -// ASSERT_DEATH ( {network_.GeneratorAt( static_cast(0) );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , GeneratorAtExceptionHandling ) -// { -// // Generator does not exist -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "GeneratorAt" -// , R"(HasGenerator \( generatorId \))"); -// try { -// network_.GeneratorAt( static_cast(0) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , GeneratorAt ) +{ + // Generator does not exist + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "GeneratorAt" + , R"(HasGenerator \( generatorId \))"); + ASSERT_DEATH ( {network_.GeneratorAt( static_cast(0) );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , GeneratorAtExceptionHandling ) +{ + // Generator does not exist + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "GeneratorAt" + , R"(HasGenerator \( generatorId \))"); + try { + network_.GeneratorAt( static_cast(0) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , GeneratorAt ) -// { -// TGeneratorProperties & generatorProperties = network_.GeneratorAt( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , GeneratorAt ) +{ + TGeneratorProperties & generatorProperties = network_.GeneratorAt( static_cast(0) ); -// GeneratorComplyInitialValues ( generatorProperties ); -// } + GeneratorComplyInitialValues ( generatorProperties ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , GeneratorAt ) -// { -// TGeneratorProperties & generatorProperties = network_.GeneratorAt( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , GeneratorAt ) +{ + TGeneratorProperties & generatorProperties = network_.GeneratorAt( static_cast(0) ); -// GeneratorComplyInitialValues ( generatorProperties ); -// } + GeneratorComplyInitialValues ( generatorProperties ); +} // TEST_F ( TestPowerGridPyPsaExample // , GeneratorAt ) @@ -1972,91 +1972,91 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // GeneratorComplyInitialValues ( generatorProperties ); // } -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark GeneratorsAtUsingVertexId -// // *********************************************************************** -// // *********************************************************************** +// *********************************************************************** +// *********************************************************************** +#pragma mark GeneratorsAtUsingVertexId +// *********************************************************************** +// *********************************************************************** -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , GeneratorsAtUsingVertexId ) -// { -// std::vector generators; +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , GeneratorsAtUsingVertexId ) +{ + std::vector generators; -// // Vertex does not exist -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "GeneratorsAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); -// ASSERT_DEATH ( {network_.GeneratorsAt( static_cast(0), generators );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , GeneratorsAtUsingVertexIdExceptionHandling ) -// { -// std::vector generators; + // Vertex does not exist + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "GeneratorsAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); + ASSERT_DEATH ( {network_.GeneratorsAt( static_cast(0), generators );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , GeneratorsAtUsingVertexIdExceptionHandling ) +{ + std::vector generators; -// // Vertex does not exist -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "GeneratorsAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.GeneratorsAt( static_cast(0), generators ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + // Vertex does not exist + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "GeneratorsAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); + try { + network_.GeneratorsAt( static_cast(0), generators ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , GeneratorsAtUsingVertexId ) -// { -// std::vector generatorProperties; -// network_.GeneratorsAt ( static_cast(0) -// , generatorProperties ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , GeneratorsAtUsingVertexId ) +{ + std::vector generatorProperties; + network_.GeneratorsAt ( static_cast(0) + , generatorProperties ); -// EXPECT_EQ ( 1, generatorProperties.size() ); -// GeneratorComplyInitialValues ( generatorProperties[0] ); + EXPECT_EQ ( 1, generatorProperties.size() ); + GeneratorComplyInitialValues ( generatorProperties[0] ); -// // Clear vector -// generatorProperties.clear(); -// EXPECT_EQ ( 0, generatorProperties.size() ); + // Clear vector + generatorProperties.clear(); + EXPECT_EQ ( 0, generatorProperties.size() ); -// // Check number of generators at vertex identifier 1 -// network_.GeneratorsAt ( static_cast(1) -// , generatorProperties ); -// EXPECT_EQ ( 0, generatorProperties.size() ); -// } + // Check number of generators at vertex identifier 1 + network_.GeneratorsAt ( static_cast(1) + , generatorProperties ); + EXPECT_EQ ( 0, generatorProperties.size() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , GeneratorsAtUsingVertexId ) -// { -// std::vector generatorProperties; -// network_.GeneratorsAt ( static_cast(0) -// , generatorProperties ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , GeneratorsAtUsingVertexId ) +{ + std::vector generatorProperties; + network_.GeneratorsAt ( static_cast(0) + , generatorProperties ); -// EXPECT_EQ ( 1, generatorProperties.size() ); -// GeneratorComplyInitialValues ( generatorProperties[0] ); + EXPECT_EQ ( 1, generatorProperties.size() ); + GeneratorComplyInitialValues ( generatorProperties[0] ); -// // Clear vector -// generatorProperties.clear(); -// EXPECT_EQ ( 0, generatorProperties.size() ); + // Clear vector + generatorProperties.clear(); + EXPECT_EQ ( 0, generatorProperties.size() ); -// // Check number of generators at vertex identifier 1 -// network_.GeneratorsAt ( static_cast(1) -// , generatorProperties ); -// EXPECT_EQ ( 0, generatorProperties.size() ); -// } + // Check number of generators at vertex identifier 1 + network_.GeneratorsAt ( static_cast(1) + , generatorProperties ); + EXPECT_EQ ( 0, generatorProperties.size() ); +} // TEST_F ( TestPowerGridPyPsaExample // , GeneratorsAtUsingVertexId ) @@ -2078,113 +2078,113 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // EXPECT_EQ ( 3, generatorProperties.size() ); // } -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark GeneratorsAtUsingVertexObject -// // *********************************************************************** -// // *********************************************************************** +// *********************************************************************** +// *********************************************************************** +#pragma mark GeneratorsAtUsingVertexObject +// *********************************************************************** +// *********************************************************************** -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , GeneratorsAtUsingVertexObject ) -// { -// std::vector generatorProperties; +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , GeneratorsAtUsingVertexObject ) +{ + std::vector generatorProperties; -// TVertexProperties vertexProperties; -// TVertex vertex0 ( 9999, vertexProperties ); + TVertexProperties vertexProperties; + TVertex vertex0 ( 9999, vertexProperties ); -// // Vertex does not exist -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "GeneratorsAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); -// ASSERT_DEATH ( {network_.GeneratorsAt( vertex0, generatorProperties );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , GeneratorsAtUsingVertexObjectExceptionHandling ) -// { -// std::vector generatorProperties; + // Vertex does not exist + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "GeneratorsAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); + ASSERT_DEATH ( {network_.GeneratorsAt( vertex0, generatorProperties );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , GeneratorsAtUsingVertexObjectExceptionHandling ) +{ + std::vector generatorProperties; -// TVertexProperties vertexProperties; -// TVertex vertex0 ( 9999, vertexProperties ); + TVertexProperties vertexProperties; + TVertex vertex0 ( 9999, vertexProperties ); -// // Vertex does not exist -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "GeneratorsAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + // Vertex does not exist + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "GeneratorsAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.GeneratorsAt( vertex0, generatorProperties ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.GeneratorsAt( vertex0, generatorProperties ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , GeneratorsAtUsingVertexObject ) -// { -// std::vector generatorProperties; +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , GeneratorsAtUsingVertexObject ) +{ + std::vector generatorProperties; -// TVertex vertex0 = network_.Graph().VertexAt ( static_cast(0) ); -// TVertex vertex1 = network_.Graph().VertexAt ( static_cast(1) ); + TVertex vertex0 = network_.Graph().VertexAt ( static_cast(0) ); + TVertex vertex1 = network_.Graph().VertexAt ( static_cast(1) ); -// network_.GeneratorsAt( vertex0, generatorProperties ); + network_.GeneratorsAt( vertex0, generatorProperties ); -// EXPECT_EQ ( 1, generatorProperties.size() ); -// GeneratorComplyInitialValues ( generatorProperties[0] ); + EXPECT_EQ ( 1, generatorProperties.size() ); + GeneratorComplyInitialValues ( generatorProperties[0] ); -// // Clear vector -// generatorProperties.clear(); -// EXPECT_EQ ( 0, generatorProperties.size() ); + // Clear vector + generatorProperties.clear(); + EXPECT_EQ ( 0, generatorProperties.size() ); -// // Check number of generators at vertex identifier 1 -// network_.GeneratorsAt( vertex1, generatorProperties ); -// EXPECT_EQ ( 0, generatorProperties.size() ); -// } + // Check number of generators at vertex identifier 1 + network_.GeneratorsAt( vertex1, generatorProperties ); + EXPECT_EQ ( 0, generatorProperties.size() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , GeneratorsAtUsingVertexObject ) -// { -// std::vector generatorPropertiesS; +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , GeneratorsAtUsingVertexObject ) +{ + std::vector generatorPropertiesS; -// // Generate generator with default values -// TGeneratorProperties generatorProperties; -// generatorProperties.Name() = "TestGenerator1"; + // Generate generator with default values + TGeneratorProperties generatorProperties; + generatorProperties.Name() = "TestGenerator1"; -// TVertex vertex0 = network_.Graph().VertexAt ( static_cast(0) ); -// TVertex vertex1 = network_.Graph().VertexAt ( static_cast(1) ); -// network_.GeneratorsAt ( vertex0, generatorPropertiesS ); + TVertex vertex0 = network_.Graph().VertexAt ( static_cast(0) ); + TVertex vertex1 = network_.Graph().VertexAt ( static_cast(1) ); + network_.GeneratorsAt ( vertex0, generatorPropertiesS ); -// EXPECT_EQ ( 1, generatorPropertiesS.size() ); -// GeneratorComplyInitialValues ( generatorPropertiesS[0] ); + EXPECT_EQ ( 1, generatorPropertiesS.size() ); + GeneratorComplyInitialValues ( generatorPropertiesS[0] ); -// // Clear vector -// generatorPropertiesS.clear(); -// network_.AddGeneratorAt ( static_cast(0), generatorProperties ); -// network_.AddGeneratorAt ( static_cast(0), generatorProperties ); -// network_.AddGeneratorAt ( static_cast(0), generatorProperties ); -// network_.GeneratorsAt ( vertex0, generatorPropertiesS ); -// EXPECT_EQ ( 4, generatorPropertiesS.size() ); + // Clear vector + generatorPropertiesS.clear(); + network_.AddGeneratorAt ( static_cast(0), generatorProperties ); + network_.AddGeneratorAt ( static_cast(0), generatorProperties ); + network_.AddGeneratorAt ( static_cast(0), generatorProperties ); + network_.GeneratorsAt ( vertex0, generatorPropertiesS ); + EXPECT_EQ ( 4, generatorPropertiesS.size() ); -// // Clear vector -// generatorPropertiesS.clear(); -// EXPECT_EQ ( 0, generatorPropertiesS.size() ); + // Clear vector + generatorPropertiesS.clear(); + EXPECT_EQ ( 0, generatorPropertiesS.size() ); -// // Check number of generators at vertex identifier 1 -// network_.GeneratorsAt( vertex1, generatorPropertiesS ); -// EXPECT_EQ ( 0, generatorPropertiesS.size() ); -// } + // Check number of generators at vertex identifier 1 + network_.GeneratorsAt( vertex1, generatorPropertiesS ); + EXPECT_EQ ( 0, generatorPropertiesS.size() ); +} // TEST_F ( TestPowerGridPyPsaExample // , GeneratorsAtUsingVertexObject ) @@ -2207,64 +2207,64 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // EXPECT_EQ ( 3, generatorPropertiesS.size() ); // } -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark FindGenerator -// // *********************************************************************** -// // *********************************************************************** +// *********************************************************************** +// *********************************************************************** +#pragma mark FindGenerator +// *********************************************************************** +// *********************************************************************** -// TEST_F ( TestNetworkEmptyDeathTest -// , FindGenerator ) -// { -// TGeneratorProperties generatorProperties; -// std::vector generators; +TEST_F ( TestNetworkEmptyDeathTest + , FindGenerator ) +{ + TGeneratorProperties generatorProperties; + std::vector generators; -// Types::generatorId generatorId = network_.FindGenerator ( generatorProperties, generators ); -// EXPECT_EQ ( Const::NONE, generatorId ); -// } + Types::generatorId generatorId = network_.FindGenerator ( generatorProperties, generators ); + EXPECT_EQ ( Const::NONE, generatorId ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , FindGenerator ) -// { -// TGeneratorProperties generatorProperties = network_.GeneratorAt ( static_cast(0) ); -// std::vector generators; +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , FindGenerator ) +{ + TGeneratorProperties generatorProperties = network_.GeneratorAt ( static_cast(0) ); + std::vector generators; -// // Add generators at the vertex with identifier 0 -// network_.AddGeneratorAt ( static_cast(0), generatorProperties ); -// network_.AddGeneratorAt ( static_cast(0), generatorProperties ); -// network_.AddGeneratorAt ( static_cast(0), generatorProperties ); + // Add generators at the vertex with identifier 0 + network_.AddGeneratorAt ( static_cast(0), generatorProperties ); + network_.AddGeneratorAt ( static_cast(0), generatorProperties ); + network_.AddGeneratorAt ( static_cast(0), generatorProperties ); -// // Get generators at a vertex with identifier 0 -// network_.GeneratorsAt ( static_cast(0), generators ); + // Get generators at a vertex with identifier 0 + network_.GeneratorsAt ( static_cast(0), generators ); -// // Find the generator that was extracted from position 0 -// Types::generatorId generatorId = network_.FindGenerator ( generatorProperties, generators ); + // Find the generator that was extracted from position 0 + Types::generatorId generatorId = network_.FindGenerator ( generatorProperties, generators ); -// // That's what we expect -// EXPECT_EQ ( 0, generatorId ); -// } + // That's what we expect + EXPECT_EQ ( 0, generatorId ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , FindGenerator ) -// { -// TGeneratorProperties generatorProperties = network_.GeneratorAt ( static_cast(0) ); -// std::vector generatorPropertiesS; +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , FindGenerator ) +{ + TGeneratorProperties generatorProperties = network_.GeneratorAt ( static_cast(0) ); + std::vector generatorPropertiesS; -// // Add generators at the vertex with identifier 0 -// network_.AddGeneratorAt ( static_cast(0), generatorProperties ); -// network_.AddGeneratorAt ( static_cast(0), generatorProperties ); -// network_.AddGeneratorAt ( static_cast(0), generatorProperties ); + // Add generators at the vertex with identifier 0 + network_.AddGeneratorAt ( static_cast(0), generatorProperties ); + network_.AddGeneratorAt ( static_cast(0), generatorProperties ); + network_.AddGeneratorAt ( static_cast(0), generatorProperties ); -// // Get generators at a vertex with identifier 0 -// network_.GeneratorsAt ( static_cast(0), generatorPropertiesS ); + // Get generators at a vertex with identifier 0 + network_.GeneratorsAt ( static_cast(0), generatorPropertiesS ); -// // Find the generator that was extracted from position 0 -// Types::generatorId generatorId = network_.FindGenerator ( generatorProperties -// , generatorPropertiesS ); + // Find the generator that was extracted from position 0 + Types::generatorId generatorId = network_.FindGenerator ( generatorProperties + , generatorPropertiesS ); -// // That's what we expect -// EXPECT_EQ ( 0, generatorId ); -// } + // That's what we expect + EXPECT_EQ ( 0, generatorId ); +} // TEST_F ( TestPowerGridPyPsaExample // , FindGenerator ) @@ -2284,238 +2284,238 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // EXPECT_EQ ( 0, generatorId ); // } -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark TotalRealPowerGenerationBoundAt -// // *********************************************************************** -// // *********************************************************************** +// *********************************************************************** +// *********************************************************************** +#pragma mark TotalRealPowerGenerationBoundAt +// *********************************************************************** +// *********************************************************************** -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , TotalRealPowerGenerationBoundAt ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalRealPowerGenerationBoundAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , TotalRealPowerGenerationBoundAt ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalRealPowerGenerationBoundAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// ASSERT_DEATH ( {network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); } -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , TotalRealPowerGenerationBoundAtExceptionHandling ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalRealPowerGenerationBoundAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + ASSERT_DEATH ( {network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); } + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , TotalRealPowerGenerationBoundAtExceptionHandling ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalRealPowerGenerationBoundAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalRealPowerGenerationBoundAtBounded ) -// { // Bounded -// network_.MakeBounded (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalRealPowerGenerationBoundAtBounded ) +{ // Bounded + network_.MakeBounded (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the bounded type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 8.0, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the bounded type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 8.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalRealPowerGenerationBoundAtBoundedHasNoGenerator ) -// { // Bounded with no generator at that vertex -// network_.MakeBounded (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalRealPowerGenerationBoundAtBoundedHasNoGenerator ) +{ // Bounded with no generator at that vertex + network_.MakeBounded (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalRealPowerGenerationBoundAtUnbounded ) -// { // Unbounded -// network_.MakeUnbounded (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalRealPowerGenerationBoundAtUnbounded ) +{ // Unbounded + network_.MakeUnbounded (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the unbounded type -// EXPECT_EQ ( 0, bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the unbounded type + EXPECT_EQ ( 0, bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalRealPowerGenerationBoundAtUnboundedHasNoGenerator ) -// { // Unbounded with no generator at that vertex -// network_.MakeUnbounded (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalRealPowerGenerationBoundAtUnboundedHasNoGenerator ) +{ // Unbounded with no generator at that vertex + network_.MakeUnbounded (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalRealPowerGenerationBoundAtPureUnbounded ) -// { // PureUnbounded -// network_.MakePureUnbounded (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalRealPowerGenerationBoundAtPureUnbounded ) +{ // PureUnbounded + network_.MakePureUnbounded (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the pure unbounded type -// EXPECT_EQ ( 0, bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the pure unbounded type + EXPECT_EQ ( 0, bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalRealPowerGenerationBoundAtPureUnboundedHasNoGenerator ) -// { // Pure unbounded with no generator at that vertex -// network_.MakePureUnbounded (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalRealPowerGenerationBoundAtPureUnboundedHasNoGenerator ) +{ // Pure unbounded with no generator at that vertex + network_.MakePureUnbounded (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalRealPowerGenerationBoundAtExact ) -// { // Exact -// network_.MakeExact (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalRealPowerGenerationBoundAtExact ) +{ // Exact + network_.MakeExact (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 1.234, bound.Minimum() ); -// EXPECT_EQ ( 1.234, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the exact type + EXPECT_EQ ( 1.234, bound.Minimum() ); + EXPECT_EQ ( 1.234, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalRealPowerGenerationBoundAtExactHasNoGenerator ) -// { // Exact with no generator at that vertex -// network_.MakeExact (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalRealPowerGenerationBoundAtExactHasNoGenerator ) +{ // Exact with no generator at that vertex + network_.MakeExact (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalRealPowerGenerationBoundAtBounded ) -// { // Bounded -// network_.MakeBounded (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalRealPowerGenerationBoundAtBounded ) +{ // Bounded + network_.MakeBounded (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the bounded type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 5.0, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the bounded type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 5.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalRealPowerGenerationBoundAtBoundedHasNoGenerator ) -// { // Bounded with no generator at that vertex -// network_.MakeBounded (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalRealPowerGenerationBoundAtBoundedHasNoGenerator ) +{ // Bounded with no generator at that vertex + network_.MakeBounded (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalRealPowerGenerationBoundAtUnbounded ) -// { // Unbounded -// network_.MakeUnbounded (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalRealPowerGenerationBoundAtUnbounded ) +{ // Unbounded + network_.MakeUnbounded (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the unbounded type -// EXPECT_EQ ( 0, bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the unbounded type + EXPECT_EQ ( 0, bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalRealPowerGenerationBoundAtUnboundedHasNoGenerator ) -// { // Unbounded with no generator at that vertex -// network_.MakeUnbounded (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalRealPowerGenerationBoundAtUnboundedHasNoGenerator ) +{ // Unbounded with no generator at that vertex + network_.MakeUnbounded (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalRealPowerGenerationBoundAtPureUnbounded ) -// { // PureUnbounded -// network_.MakePureUnbounded (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalRealPowerGenerationBoundAtPureUnbounded ) +{ // PureUnbounded + network_.MakePureUnbounded (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the pure unbounded type -// EXPECT_EQ ( 0, bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the pure unbounded type + EXPECT_EQ ( 0, bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalRealPowerGenerationBoundAtPureUnboundedHasNoGenerator ) -// { // Pure unbounded with no generator at that vertex -// network_.MakePureUnbounded (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalRealPowerGenerationBoundAtPureUnboundedHasNoGenerator ) +{ // Pure unbounded with no generator at that vertex + network_.MakePureUnbounded (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b, TotalRealPowerGenerationBoundAtExact ) -// { // Exact -// network_.MakeExact (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b, TotalRealPowerGenerationBoundAtExact ) +{ // Exact + network_.MakeExact (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalRealPowerGenerationBoundAtExactHasNoGenerator ) -// { // Exact with no generator at that vertex -// network_.MakeExact (); -// TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalRealPowerGenerationBoundAtExactHasNoGenerator ) +{ // Exact with no generator at that vertex + network_.MakeExact (); + TBound bound = network_.TotalRealPowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} // TEST_F ( TestPowerGridPyPsaExample // , TotalRealPowerGenerationBoundAtBounded ) @@ -2530,159 +2530,159 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // EXPECT_EQ ( std::numeric_limits::infinity(), bound.Maximum() ); // } -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark TotalRealPowerGenerationAt -// // *********************************************************************** -// // *********************************************************************** - -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , TotalRealPowerGenerationAt ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalRealPowerGenerationAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); +// *********************************************************************** +// *********************************************************************** +#pragma mark TotalRealPowerGenerationAt +// *********************************************************************** +// *********************************************************************** -// ASSERT_DEATH ( {network_.TotalRealPowerGenerationAt ( static_cast(0) ); } -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , TotalRealPowerGenerationAtExceptionHandling ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalRealPowerGenerationAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , TotalRealPowerGenerationAt ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalRealPowerGenerationAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.TotalRealPowerGenerationAt ( static_cast(0) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + ASSERT_DEATH ( {network_.TotalRealPowerGenerationAt ( static_cast(0) ); } + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , TotalRealPowerGenerationAtExceptionHandling ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalRealPowerGenerationAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest -// , TotalRealPowerGenerationAtNonExistingVertex ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalRealPowerGenerationAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + try { + network_.TotalRealPowerGenerationAt ( static_cast(0) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// ASSERT_DEATH ( {network_.TotalRealPowerGenerationAt ( static_cast(9) );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalRealPowerGenerationAtNonExistingVertexExceptionHandling ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalRealPowerGenerationAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest + , TotalRealPowerGenerationAtNonExistingVertex ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalRealPowerGenerationAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.TotalRealPowerGenerationAt ( static_cast(9) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + ASSERT_DEATH ( {network_.TotalRealPowerGenerationAt ( static_cast(9) );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalRealPowerGenerationAtNonExistingVertexExceptionHandling ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalRealPowerGenerationAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalRealPowerGenerationAtWithVertexThatHasNoGenerator ) -// { -// Types::real value = network_.TotalRealPowerGenerationAt ( static_cast(1) ); + try { + network_.TotalRealPowerGenerationAt ( static_cast(9) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test the total real power generation -// EXPECT_EQ ( 0.0, value ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalRealPowerGenerationAtWithVertexThatHasNoGenerator ) +{ + Types::real value = network_.TotalRealPowerGenerationAt ( static_cast(1) ); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalRealPowerGenerationAt ) -// { -// Types::real value = network_.TotalRealPowerGenerationAt ( static_cast(0) ); + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test the total real power generation + EXPECT_EQ ( 0.0, value ); +} -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test the total real power generation -// EXPECT_EQ ( 1.234, value ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalRealPowerGenerationAt ) +{ + Types::real value = network_.TotalRealPowerGenerationAt ( static_cast(0) ); -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4bDeathTest -// , TotalRealPowerGenerationAtNonExistingVertex ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalRealPowerGenerationAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test the total real power generation + EXPECT_EQ ( 1.234, value ); +} -// ASSERT_DEATH ( {network_.TotalRealPowerGenerationAt ( static_cast(9) );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalRealPowerGenerationAtNonExistingVertexExceptionHandling ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalRealPowerGenerationAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestPowerGridAcm2018MtsfFigure4bDeathTest + , TotalRealPowerGenerationAtNonExistingVertex ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalRealPowerGenerationAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.TotalRealPowerGenerationAt ( static_cast(9) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + ASSERT_DEATH ( {network_.TotalRealPowerGenerationAt ( static_cast(9) );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalRealPowerGenerationAtNonExistingVertexExceptionHandling ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalRealPowerGenerationAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalRealPowerGenerationAtWithVertexThatHasNoGenerator ) -// { -// Types::real value = network_.TotalRealPowerGenerationAt ( static_cast(1) ); + try { + network_.TotalRealPowerGenerationAt ( static_cast(9) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test the total real power generation -// EXPECT_EQ ( 0.0, value ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalRealPowerGenerationAtWithVertexThatHasNoGenerator ) +{ + Types::real value = network_.TotalRealPowerGenerationAt ( static_cast(1) ); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalRealPowerGenerationAt ) -// { -// Types::real value = network_.TotalRealPowerGenerationAt ( static_cast(0) ); + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test the total real power generation + EXPECT_EQ ( 0.0, value ); +} -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test the total real power generation -// EXPECT_EQ ( 0.0, value ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalRealPowerGenerationAt ) +{ + Types::real value = network_.TotalRealPowerGenerationAt ( static_cast(0) ); + + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test the total real power generation + EXPECT_EQ ( 0.0, value ); +} // TEST_F ( TestPowerGridPyPsaExample // , TotalRealPowerGenerationAt ) @@ -2714,393 +2714,393 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // } -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark TotalReactivePowerGenerationBoundAt -// // *********************************************************************** -// // *********************************************************************** +// *********************************************************************** +// *********************************************************************** +#pragma mark TotalReactivePowerGenerationBoundAt +// *********************************************************************** +// *********************************************************************** -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , TotalReactivePowerGenerationBoundAt ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalReactivePowerGenerationBoundAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , TotalReactivePowerGenerationBoundAt ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalReactivePowerGenerationBoundAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// ASSERT_DEATH ( {network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); } -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , TotalReactivePowerGenerationBoundAtExceptionHandling ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalReactivePowerGenerationBoundAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + ASSERT_DEATH ( {network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); } + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , TotalReactivePowerGenerationBoundAtExceptionHandling ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalReactivePowerGenerationBoundAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalReactivePowerGenerationBoundAtBounded ) -// { // Bounded -// network_.MakeBounded (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalReactivePowerGenerationBoundAtBounded ) +{ // Bounded + network_.MakeBounded (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the bounded type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 2.0, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the bounded type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 2.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalReactivePowerGenerationBoundAtBoundedHasNoGenerator ) -// { // Bounded with no generator at that vertex -// network_.MakeBounded (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalReactivePowerGenerationBoundAtBoundedHasNoGenerator ) +{ // Bounded with no generator at that vertex + network_.MakeBounded (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalReactivePowerGenerationBoundAtUnbounded ) -// { // Unbounded -// network_.MakeUnbounded (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalReactivePowerGenerationBoundAtUnbounded ) +{ // Unbounded + network_.MakeUnbounded (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the unbounded type -// EXPECT_EQ ( 0, bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the unbounded type + EXPECT_EQ ( 0, bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalReactivePowerGenerationBoundAtUnboundedHasNoGenerator ) -// { // Unbounded with no generator at that vertex -// network_.MakeUnbounded (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalReactivePowerGenerationBoundAtUnboundedHasNoGenerator ) +{ // Unbounded with no generator at that vertex + network_.MakeUnbounded (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalReactivePowerGenerationBoundAtPureUnbounded ) -// { // PureUnbounded -// network_.MakePureUnbounded (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalReactivePowerGenerationBoundAtPureUnbounded ) +{ // PureUnbounded + network_.MakePureUnbounded (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the pure unbounded type -// EXPECT_EQ ( 0, bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the pure unbounded type + EXPECT_EQ ( 0, bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalReactivePowerGenerationBoundAtPureUnboundedHasNoGenerator ) -// { // Pure unbounded with no generator at that vertex -// network_.MakePureUnbounded (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalReactivePowerGenerationBoundAtPureUnboundedHasNoGenerator ) +{ // Pure unbounded with no generator at that vertex + network_.MakePureUnbounded (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalReactivePowerGenerationBoundAtExact ) -// { // Exact -// network_.MakeExact (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalReactivePowerGenerationBoundAtExact ) +{ // Exact + network_.MakeExact (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 1.111, bound.Minimum() ); -// EXPECT_EQ ( 1.111, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the exact type + EXPECT_EQ ( 1.111, bound.Minimum() ); + EXPECT_EQ ( 1.111, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalReactivePowerGenerationBoundAtExactHasNoGenerator ) -// { // Exact with no generator at that vertex -// network_.MakeExact (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalReactivePowerGenerationBoundAtExactHasNoGenerator ) +{ // Exact with no generator at that vertex + network_.MakeExact (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalReactivePowerGenerationBoundAtBounded ) -// { // Bounded -// network_.MakeBounded (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalReactivePowerGenerationBoundAtBounded ) +{ // Bounded + network_.MakeBounded (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the bounded type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the bounded type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalReactivePowerGenerationBoundAtBoundedHasNoGenerator ) -// { // Bounded with no generator at that vertex -// network_.MakeBounded (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalReactivePowerGenerationBoundAtBoundedHasNoGenerator ) +{ // Bounded with no generator at that vertex + network_.MakeBounded (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalReactivePowerGenerationBoundAtUnbounded ) -// { // Unbounded -// network_.MakeUnbounded (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalReactivePowerGenerationBoundAtUnbounded ) +{ // Unbounded + network_.MakeUnbounded (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the unbounded type -// EXPECT_EQ ( 0, bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the unbounded type + EXPECT_EQ ( 0, bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalReactivePowerGenerationBoundAtUnboundedHasNoGenerator ) -// { // Unbounded with no generator at that vertex -// network_.MakeUnbounded (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalReactivePowerGenerationBoundAtUnboundedHasNoGenerator ) +{ // Unbounded with no generator at that vertex + network_.MakeUnbounded (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalReactivePowerGenerationBoundAtPureUnbounded ) -// { // PureUnbounded -// network_.MakePureUnbounded (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalReactivePowerGenerationBoundAtPureUnbounded ) +{ // PureUnbounded + network_.MakePureUnbounded (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the pure unbounded type -// EXPECT_EQ ( 0, bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the pure unbounded type + EXPECT_EQ ( 0, bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalReactivePowerGenerationBoundAtPureUnboundedHasNoGenerator ) -// { // Pure unbounded with no generator at that vertex -// network_.MakePureUnbounded (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalReactivePowerGenerationBoundAtPureUnboundedHasNoGenerator ) +{ // Pure unbounded with no generator at that vertex + network_.MakePureUnbounded (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalReactivePowerGenerationBoundAtExact ) -// { // Exact -// network_.MakeExact (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalReactivePowerGenerationBoundAtExact ) +{ // Exact + network_.MakeExact (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalReactivePowerGenerationBoundAtExactHasNoGenerator ) -// { // Exact with no generator at that vertex -// network_.MakeExact (); -// TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalReactivePowerGenerationBoundAtExactHasNoGenerator ) +{ // Exact with no generator at that vertex + network_.MakeExact (); + TBound bound = network_.TotalReactivePowerGenerationBoundAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test bound for the exact type -// EXPECT_EQ ( 0.0, bound.Minimum() ); -// EXPECT_EQ ( 0.0, bound.Maximum() ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test bound for the exact type + EXPECT_EQ ( 0.0, bound.Minimum() ); + EXPECT_EQ ( 0.0, bound.Maximum() ); +} -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark TotalReactivePowerGenerationAt -// // *********************************************************************** -// // *********************************************************************** +// *********************************************************************** +// *********************************************************************** +#pragma mark TotalReactivePowerGenerationAt +// *********************************************************************** +// *********************************************************************** -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , TotalReactivePowerGenerationAt ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalReactivePowerGenerationAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , TotalReactivePowerGenerationAt ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalReactivePowerGenerationAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// ASSERT_DEATH ( {network_.TotalReactivePowerGenerationAt ( static_cast(0) ); } -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , TotalReactivePowerGenerationAtExceptionHandling ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalReactivePowerGenerationAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + ASSERT_DEATH ( {network_.TotalReactivePowerGenerationAt ( static_cast(0) ); } + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , TotalReactivePowerGenerationAtExceptionHandling ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalReactivePowerGenerationAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.TotalReactivePowerGenerationAt ( static_cast(0) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.TotalReactivePowerGenerationAt ( static_cast(0) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest -// , TotalReactivePowerGenerationAtNonExistingVertex ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalReactivePowerGenerationAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest + , TotalReactivePowerGenerationAtNonExistingVertex ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalReactivePowerGenerationAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// ASSERT_DEATH ( {network_.TotalReactivePowerGenerationAt ( static_cast(9) );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalReactivePowerGenerationAtNonExistingVertexExceptionHandling ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalReactivePowerGenerationAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + ASSERT_DEATH ( {network_.TotalReactivePowerGenerationAt ( static_cast(9) );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalReactivePowerGenerationAtNonExistingVertexExceptionHandling ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalReactivePowerGenerationAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.TotalReactivePowerGenerationAt ( static_cast(9) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.TotalReactivePowerGenerationAt ( static_cast(9) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalReactivePowerGenerationAtWithVertexThatHasNoGenerator ) -// { -// Types::real value = network_.TotalReactivePowerGenerationAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalReactivePowerGenerationAtWithVertexThatHasNoGenerator ) +{ + Types::real value = network_.TotalReactivePowerGenerationAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test the total real power generation -// EXPECT_EQ ( 0.0, value ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test the total real power generation + EXPECT_EQ ( 0.0, value ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalReactivePowerGenerationAt ) -// { -// Types::real value = network_.TotalReactivePowerGenerationAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalReactivePowerGenerationAt ) +{ + Types::real value = network_.TotalReactivePowerGenerationAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test the total real power generation -// EXPECT_EQ ( 1.111, value ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test the total real power generation + EXPECT_EQ ( 1.111, value ); +} -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4bDeathTest -// , TotalReactivePowerGenerationAtNonExistingVertex ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalReactivePowerGenerationAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestPowerGridAcm2018MtsfFigure4bDeathTest + , TotalReactivePowerGenerationAtNonExistingVertex ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalReactivePowerGenerationAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// ASSERT_DEATH ( {network_.TotalReactivePowerGenerationAt ( static_cast(9) );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalReactivePowerGenerationAtNonExistingVertexExceptionHandling ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalReactivePowerGenerationAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + ASSERT_DEATH ( {network_.TotalReactivePowerGenerationAt ( static_cast(9) );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalReactivePowerGenerationAtNonExistingVertexExceptionHandling ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalReactivePowerGenerationAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.TotalReactivePowerGenerationAt ( static_cast(9) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.TotalReactivePowerGenerationAt ( static_cast(9) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalReactivePowerGenerationAtWithVertexThatHasNoGenerator ) -// { -// Types::real value = network_.TotalReactivePowerGenerationAt ( static_cast(1) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalReactivePowerGenerationAtWithVertexThatHasNoGenerator ) +{ + Types::real value = network_.TotalReactivePowerGenerationAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// // Test the total real power generation -// EXPECT_EQ ( 0.0, value ); -// } + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); + // Test the total real power generation + EXPECT_EQ ( 0.0, value ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalReactivePowerGenerationAt ) -// { -// Types::real value = network_.TotalReactivePowerGenerationAt ( static_cast(0) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalReactivePowerGenerationAt ) +{ + Types::real value = network_.TotalReactivePowerGenerationAt ( static_cast(0) ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); -// // Test the total real power generation -// EXPECT_EQ ( 0.0, value ); -// } + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(0) ) ); + // Test the total real power generation + EXPECT_EQ ( 0.0, value ); +} // TEST_F ( TestPowerGridPyPsaExample // , TotalReactivePowerGenerationAt ) @@ -3114,2087 +3114,2087 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // EXPECT_EQ ( 0.0, value ); // } -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark AddLoadAtVertexId -// // *********************************************************************** -// // *********************************************************************** +// *********************************************************************** +// *********************************************************************** +#pragma mark AddLoadAtVertexId +// *********************************************************************** +// *********************************************************************** -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , AddLoadAtUsingVertexId ) -// { -// TLoadProperties loadProperties; +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , AddLoadAtUsingVertexId ) +{ + TLoadProperties loadProperties; -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddLoadAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddLoadAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// ASSERT_DEATH ( {network_.AddLoadAt ( static_cast(0), loadProperties ); } -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , AddLoadAtUsingVertexIdExceptionHandling ) -// { -// TLoadProperties loadProperties; + ASSERT_DEATH ( {network_.AddLoadAt ( static_cast(0), loadProperties ); } + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , AddLoadAtUsingVertexIdExceptionHandling ) +{ + TLoadProperties loadProperties; -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddLoadAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddLoadAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.AddLoadAt ( static_cast(0), loadProperties ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.AddLoadAt ( static_cast(0), loadProperties ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmpty -// , AddLoadAtUsingVertexId ) -// { -// // Add vertex -// TVertexProperties vertexProperties; -// Types::vertexId vertexId = network_.Graph().AddVertex ( vertexProperties ); -// EXPECT_EQ ( 0, network_.NumberOfLoads() ); -// EXPECT_FALSE ( network_.HasLoadAt ( vertexId ) ); - -// // Add load at vertex -// TLoadProperties loadProperties; -// loadProperties.Name() = "TestLoad1"; -// Types::loadId loadId = network_.AddLoadAt ( vertexId, loadProperties ); -// // Check -// EXPECT_EQ ( 0, vertexId ); -// EXPECT_TRUE ( network_.HasLoadAt ( vertexId ) ); -// EXPECT_TRUE ( network_.HasLoad ( loadId ) ); -// EXPECT_EQ ( 0, loadId ); -// EXPECT_EQ ( 1, network_.NumberOfLoads() ); -// EXPECT_FALSE( network_.HasLoad ( static_cast(1) ) ); -// } +TEST_F ( TestNetworkEmpty + , AddLoadAtUsingVertexId ) +{ + // Add vertex + TVertexProperties vertexProperties; + Types::vertexId vertexId = network_.Graph().AddVertex ( vertexProperties ); + EXPECT_EQ ( 0, network_.NumberOfLoads() ); + EXPECT_FALSE ( network_.HasLoadAt ( vertexId ) ); + + // Add load at vertex + TLoadProperties loadProperties; + loadProperties.Name() = "TestLoad1"; + Types::loadId loadId = network_.AddLoadAt ( vertexId, loadProperties ); + // Check + EXPECT_EQ ( 0, vertexId ); + EXPECT_TRUE ( network_.HasLoadAt ( vertexId ) ); + EXPECT_TRUE ( network_.HasLoad ( loadId ) ); + EXPECT_EQ ( 0, loadId ); + EXPECT_EQ ( 1, network_.NumberOfLoads() ); + EXPECT_FALSE( network_.HasLoad ( static_cast(1) ) ); +} -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest -// , AddLoadAtUsingVertexIdNonExistingVertexId ) -// { -// TLoadProperties loadProperties; -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddLoadAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest + , AddLoadAtUsingVertexIdNonExistingVertexId ) +{ + TLoadProperties loadProperties; + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddLoadAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// ASSERT_DEATH ( {network_.AddLoadAt ( static_cast(9), loadProperties );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , AddLoadAtUsingVertexIdNonExistingVertexIdExceptionHandling ) -// { -// TLoadProperties loadProperties; -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddLoadAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + ASSERT_DEATH ( {network_.AddLoadAt ( static_cast(9), loadProperties );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , AddLoadAtUsingVertexIdNonExistingVertexIdExceptionHandling ) +{ + TLoadProperties loadProperties; + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddLoadAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.AddLoadAt ( static_cast(9), loadProperties ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.AddLoadAt ( static_cast(9), loadProperties ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , AddLoadAtUsingVertexId ) -// { -// Types::vertexId vertexId = static_cast(2); -// EXPECT_EQ ( 1, network_.NumberOfLoads() ); -// EXPECT_FALSE ( network_.HasLoadAt ( vertexId ) ); -// // Add load at vertex 2 -// TLoadProperties loadProperties; -// Types::loadId loadId = network_.AddLoadAt ( vertexId, loadProperties ); -// // Check -// EXPECT_TRUE ( network_.HasLoadAt ( vertexId ) ); -// EXPECT_TRUE ( network_.HasLoad ( loadId ) ); -// EXPECT_EQ ( 1, loadId ); -// EXPECT_EQ ( 2, network_.NumberOfLoads() ); -// EXPECT_FALSE ( network_.HasLoadAt ( static_cast(0) ) ); -// EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , AddLoadAtUsingVertexId ) +{ + Types::vertexId vertexId = static_cast(2); + EXPECT_EQ ( 1, network_.NumberOfLoads() ); + EXPECT_FALSE ( network_.HasLoadAt ( vertexId ) ); + // Add load at vertex 2 + TLoadProperties loadProperties; + Types::loadId loadId = network_.AddLoadAt ( vertexId, loadProperties ); + // Check + EXPECT_TRUE ( network_.HasLoadAt ( vertexId ) ); + EXPECT_TRUE ( network_.HasLoad ( loadId ) ); + EXPECT_EQ ( 1, loadId ); + EXPECT_EQ ( 2, network_.NumberOfLoads() ); + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(0) ) ); + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , AddLoadAtUsingVertexId ) -// { -// Types::vertexId vertexId = static_cast(1); -// EXPECT_EQ ( 1, network_.NumberOfLoads() ); -// EXPECT_FALSE ( network_.HasLoadAt ( vertexId ) ); -// // Add load at vertex 2 -// TLoadProperties loadProperties; -// Types::loadId loadId = network_.AddLoadAt ( vertexId, loadProperties ); -// // Check -// EXPECT_TRUE ( network_.HasLoadAt ( vertexId ) ); -// EXPECT_TRUE ( network_.HasLoad ( loadId ) ); -// EXPECT_EQ ( 1, loadId ); -// EXPECT_EQ ( 2, network_.NumberOfLoads() ); -// EXPECT_FALSE ( network_.HasLoadAt ( static_cast(0) ) ); -// EXPECT_FALSE ( network_.HasLoadAt ( static_cast(2) ) ); - -// loadId = network_.AddLoadAt ( vertexId, loadProperties ); -// EXPECT_EQ ( 3, network_.NumberOfLoads() ); -// EXPECT_EQ ( 2, loadId ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , AddLoadAtUsingVertexId ) +{ + Types::vertexId vertexId = static_cast(1); + EXPECT_EQ ( 1, network_.NumberOfLoads() ); + EXPECT_FALSE ( network_.HasLoadAt ( vertexId ) ); + // Add load at vertex 2 + TLoadProperties loadProperties; + Types::loadId loadId = network_.AddLoadAt ( vertexId, loadProperties ); + // Check + EXPECT_TRUE ( network_.HasLoadAt ( vertexId ) ); + EXPECT_TRUE ( network_.HasLoad ( loadId ) ); + EXPECT_EQ ( 1, loadId ); + EXPECT_EQ ( 2, network_.NumberOfLoads() ); + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(0) ) ); + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(2) ) ); + + loadId = network_.AddLoadAt ( vertexId, loadProperties ); + EXPECT_EQ ( 3, network_.NumberOfLoads() ); + EXPECT_EQ ( 2, loadId ); +} -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark AddLoadAtVertexObject -// // *********************************************************************** -// // *********************************************************************** +// *********************************************************************** +// *********************************************************************** +#pragma mark AddLoadAtVertexObject +// *********************************************************************** +// *********************************************************************** -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , AddLoadAtVertexObject ) -// { -// TLoadProperties loadProperties; -// TVertexProperties vertexProperties; -// TVertex vertex ( 9999, vertexProperties ); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , AddLoadAtVertexObject ) +{ + TLoadProperties loadProperties; + TVertexProperties vertexProperties; + TVertex vertex ( 9999, vertexProperties ); -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddLoadAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddLoadAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// ASSERT_DEATH ( {network_.AddLoadAt ( vertex, loadProperties ); } -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , AddLoadAtVertexObjectExceptionHandling ) -// { -// TLoadProperties loadProperties; -// TVertexProperties vertexProperties; -// TVertex vertex ( 9999, vertexProperties ); + ASSERT_DEATH ( {network_.AddLoadAt ( vertex, loadProperties ); } + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , AddLoadAtVertexObjectExceptionHandling ) +{ + TLoadProperties loadProperties; + TVertexProperties vertexProperties; + TVertex vertex ( 9999, vertexProperties ); -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddLoadAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddLoadAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.AddLoadAt ( vertex, loadProperties ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.AddLoadAt ( vertex, loadProperties ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmpty -// , AddLoadAtVertexObject ) -// { -// TVertexProperties vertexProperties; -// Types::vertexId vertexId = network_.Graph().AddVertex ( vertexProperties ); -// TVertex vertex = network_.Graph().VertexAt ( vertexId ); -// vertex = networkConst_.Graph().VertexAt ( vertexId ); - -// TLoadProperties loadProperties; -// loadProperties.Name() = "TestLoad1"; -// Types::loadId loadId = network_.AddLoadAt ( vertex, loadProperties ); - -// EXPECT_EQ ( 0, vertexId ); -// EXPECT_TRUE ( network_.HasLoadAt ( vertex ) ); -// EXPECT_TRUE ( networkConst_.HasLoadAt ( vertex ) ); -// EXPECT_TRUE ( network_.HasLoad ( loadId ) ); -// EXPECT_TRUE ( networkConst_.HasLoad ( loadId ) ); -// EXPECT_EQ ( 0, loadId ); -// EXPECT_EQ ( 1, network_.NumberOfLoads() ); -// EXPECT_EQ ( 1, networkConst_.NumberOfLoads() ); -// EXPECT_FALSE( network_.HasLoad ( static_cast(1) ) ); -// EXPECT_FALSE( networkConst_.HasLoad ( static_cast(1) ) ); -// } +TEST_F ( TestNetworkEmpty + , AddLoadAtVertexObject ) +{ + TVertexProperties vertexProperties; + Types::vertexId vertexId = network_.Graph().AddVertex ( vertexProperties ); + TVertex vertex = network_.Graph().VertexAt ( vertexId ); + vertex = networkConst_.Graph().VertexAt ( vertexId ); + + TLoadProperties loadProperties; + loadProperties.Name() = "TestLoad1"; + Types::loadId loadId = network_.AddLoadAt ( vertex, loadProperties ); + + EXPECT_EQ ( 0, vertexId ); + EXPECT_TRUE ( network_.HasLoadAt ( vertex ) ); + EXPECT_TRUE ( networkConst_.HasLoadAt ( vertex ) ); + EXPECT_TRUE ( network_.HasLoad ( loadId ) ); + EXPECT_TRUE ( networkConst_.HasLoad ( loadId ) ); + EXPECT_EQ ( 0, loadId ); + EXPECT_EQ ( 1, network_.NumberOfLoads() ); + EXPECT_EQ ( 1, networkConst_.NumberOfLoads() ); + EXPECT_FALSE( network_.HasLoad ( static_cast(1) ) ); + EXPECT_FALSE( networkConst_.HasLoad ( static_cast(1) ) ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , AddLoadAtVertexObject ) -// { -// TVertex vertex = network_.Graph().VertexAt ( static_cast(2) ); -// EXPECT_FALSE ( network_.HasLoadAt ( vertex ) ); - -// vertex = networkConst_.Graph().VertexAt ( static_cast(2) ); -// EXPECT_FALSE ( networkConst_.HasLoadAt ( vertex ) ); - -// EXPECT_EQ ( 1, network_.NumberOfLoads() ); -// EXPECT_EQ ( 1, networkConst_.NumberOfLoads() ); - -// // Add load at vertex 2 -// TLoadProperties loadProperties; -// Types::loadId loadId = network_.AddLoadAt ( vertex, loadProperties ); -// // Check -// EXPECT_TRUE ( network_.HasLoadAt ( vertex ) ); -// EXPECT_TRUE ( networkConst_.HasLoadAt ( vertex ) ); -// EXPECT_TRUE ( network_.HasLoad ( loadId ) ); -// EXPECT_TRUE ( networkConst_.HasLoad ( loadId ) ); -// EXPECT_EQ ( 1, loadId ); -// EXPECT_EQ ( 2, network_.NumberOfLoads() ); -// EXPECT_EQ ( 2, networkConst_.NumberOfLoads() ); -// EXPECT_TRUE ( network_.HasLoadAt ( vertex ) ); -// EXPECT_TRUE ( networkConst_.HasLoadAt ( vertex ) ); -// EXPECT_FALSE ( network_.HasLoadAt ( static_cast(0) ) ); -// EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(0) ) ); -// EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); -// EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(1) ) ); -// EXPECT_TRUE ( network_.HasLoadAt ( static_cast(3) ) ); -// EXPECT_TRUE ( networkConst_.HasLoadAt ( static_cast(3) ) ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , AddLoadAtVertexObject ) +{ + TVertex vertex = network_.Graph().VertexAt ( static_cast(2) ); + EXPECT_FALSE ( network_.HasLoadAt ( vertex ) ); + + vertex = networkConst_.Graph().VertexAt ( static_cast(2) ); + EXPECT_FALSE ( networkConst_.HasLoadAt ( vertex ) ); + + EXPECT_EQ ( 1, network_.NumberOfLoads() ); + EXPECT_EQ ( 1, networkConst_.NumberOfLoads() ); + + // Add load at vertex 2 + TLoadProperties loadProperties; + Types::loadId loadId = network_.AddLoadAt ( vertex, loadProperties ); + // Check + EXPECT_TRUE ( network_.HasLoadAt ( vertex ) ); + EXPECT_TRUE ( networkConst_.HasLoadAt ( vertex ) ); + EXPECT_TRUE ( network_.HasLoad ( loadId ) ); + EXPECT_TRUE ( networkConst_.HasLoad ( loadId ) ); + EXPECT_EQ ( 1, loadId ); + EXPECT_EQ ( 2, network_.NumberOfLoads() ); + EXPECT_EQ ( 2, networkConst_.NumberOfLoads() ); + EXPECT_TRUE ( network_.HasLoadAt ( vertex ) ); + EXPECT_TRUE ( networkConst_.HasLoadAt ( vertex ) ); + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(0) ) ); + EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(0) ) ); + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); + EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(1) ) ); + EXPECT_TRUE ( network_.HasLoadAt ( static_cast(3) ) ); + EXPECT_TRUE ( networkConst_.HasLoadAt ( static_cast(3) ) ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , AddLoadAtVertexObject ) -// { -// TVertex vertex = network_.Graph().VertexAt ( static_cast(1) ); -// EXPECT_FALSE ( network_.HasLoadAt ( vertex ) ); - -// vertex = networkConst_.Graph().VertexAt ( static_cast(1) ); -// EXPECT_FALSE ( networkConst_.HasLoadAt ( vertex ) ); - -// EXPECT_EQ ( 1, network_.NumberOfLoads() ); -// EXPECT_EQ ( 1, networkConst_.NumberOfLoads() ); -// // Add load at vertex 2 -// TLoadProperties loadProperties; -// Types::loadId loadId = network_.AddLoadAt ( vertex, loadProperties ); -// // Check -// EXPECT_TRUE ( network_.HasLoadAt ( vertex ) ); -// EXPECT_TRUE ( networkConst_.HasLoadAt ( vertex ) ); -// EXPECT_TRUE ( network_.HasLoad ( loadId ) ); -// EXPECT_TRUE ( networkConst_.HasLoad ( loadId ) ); -// EXPECT_EQ ( 1, loadId ); -// EXPECT_EQ ( 2, network_.NumberOfLoads() ); -// EXPECT_EQ ( 2, networkConst_.NumberOfLoads() ); -// EXPECT_TRUE ( network_.HasLoadAt ( vertex ) ); -// EXPECT_TRUE ( networkConst_.HasLoadAt ( vertex ) ); -// EXPECT_FALSE ( network_.HasLoadAt ( network_.Graph().VertexAt ( static_cast(0) ) ) ); -// EXPECT_FALSE ( networkConst_.HasLoadAt ( networkConst_.Graph().VertexAt ( static_cast(0) ) ) ); -// EXPECT_FALSE ( network_.HasLoadAt ( network_.Graph().VertexAt ( static_cast(2) ) ) ); -// EXPECT_FALSE ( networkConst_.HasLoadAt ( networkConst_.Graph().VertexAt ( static_cast(2) ) ) ); -// EXPECT_TRUE ( network_.HasLoadAt ( network_.Graph().VertexAt ( static_cast(3) ) ) ); -// EXPECT_TRUE ( networkConst_.HasLoadAt ( networkConst_.Graph().VertexAt ( static_cast(3) ) ) ); - -// loadId = network_.AddLoadAt ( vertex, loadProperties ); -// EXPECT_EQ ( 3, network_.NumberOfLoads() ); -// EXPECT_EQ ( 3, networkConst_.NumberOfLoads() ); -// EXPECT_EQ ( 2, loadId ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , AddLoadAtVertexObject ) +{ + TVertex vertex = network_.Graph().VertexAt ( static_cast(1) ); + EXPECT_FALSE ( network_.HasLoadAt ( vertex ) ); + + vertex = networkConst_.Graph().VertexAt ( static_cast(1) ); + EXPECT_FALSE ( networkConst_.HasLoadAt ( vertex ) ); + + EXPECT_EQ ( 1, network_.NumberOfLoads() ); + EXPECT_EQ ( 1, networkConst_.NumberOfLoads() ); + // Add load at vertex 2 + TLoadProperties loadProperties; + Types::loadId loadId = network_.AddLoadAt ( vertex, loadProperties ); + // Check + EXPECT_TRUE ( network_.HasLoadAt ( vertex ) ); + EXPECT_TRUE ( networkConst_.HasLoadAt ( vertex ) ); + EXPECT_TRUE ( network_.HasLoad ( loadId ) ); + EXPECT_TRUE ( networkConst_.HasLoad ( loadId ) ); + EXPECT_EQ ( 1, loadId ); + EXPECT_EQ ( 2, network_.NumberOfLoads() ); + EXPECT_EQ ( 2, networkConst_.NumberOfLoads() ); + EXPECT_TRUE ( network_.HasLoadAt ( vertex ) ); + EXPECT_TRUE ( networkConst_.HasLoadAt ( vertex ) ); + EXPECT_FALSE ( network_.HasLoadAt ( network_.Graph().VertexAt ( static_cast(0) ) ) ); + EXPECT_FALSE ( networkConst_.HasLoadAt ( networkConst_.Graph().VertexAt ( static_cast(0) ) ) ); + EXPECT_FALSE ( network_.HasLoadAt ( network_.Graph().VertexAt ( static_cast(2) ) ) ); + EXPECT_FALSE ( networkConst_.HasLoadAt ( networkConst_.Graph().VertexAt ( static_cast(2) ) ) ); + EXPECT_TRUE ( network_.HasLoadAt ( network_.Graph().VertexAt ( static_cast(3) ) ) ); + EXPECT_TRUE ( networkConst_.HasLoadAt ( networkConst_.Graph().VertexAt ( static_cast(3) ) ) ); + + loadId = network_.AddLoadAt ( vertex, loadProperties ); + EXPECT_EQ ( 3, network_.NumberOfLoads() ); + EXPECT_EQ ( 3, networkConst_.NumberOfLoads() ); + EXPECT_EQ ( 2, loadId ); +} -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark RemoveLoadAtVertexId -// // *********************************************************************** -// // *********************************************************************** +// *********************************************************************** +// *********************************************************************** +#pragma mark RemoveLoadAtVertexId +// *********************************************************************** +// *********************************************************************** -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , RemoveLoadAtUsingVertexIdLoadId ) -// { -// EXPECT_EQ ( 0, network_.NumberOfLoads() ); -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "RemoveLoadAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , RemoveLoadAtUsingVertexIdLoadId ) +{ + EXPECT_EQ ( 0, network_.NumberOfLoads() ); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "RemoveLoadAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// ASSERT_DEATH ( {network_.RemoveLoadAt ( static_cast(0) -// , static_cast(0) );} -// , assertionString ); + ASSERT_DEATH ( {network_.RemoveLoadAt ( static_cast(0) + , static_cast(0) );} + , assertionString ); -// assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "HasLoadAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); -// ASSERT_DEATH ( {network_.HasLoadAt ( static_cast(0) );}, assertionString ); + assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "HasLoadAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); + ASSERT_DEATH ( {network_.HasLoadAt ( static_cast(0) );}, assertionString ); -// EXPECT_FALSE ( network_.HasLoad ( static_cast(0) ) ); -// EXPECT_EQ ( 0, network_.NumberOfLoads() ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , RemoveLoadAtUsingVertexIdLoadIdExceptionHandling ) -// { -// EXPECT_EQ ( 0, network_.NumberOfLoads() ); -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "RemoveLoadAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); - -// try { -// network_.RemoveLoadAt ( static_cast(0) -// , static_cast(0) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } - -// assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "HasLoadAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.HasLoadAt ( static_cast(0) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } + EXPECT_FALSE ( network_.HasLoad ( static_cast(0) ) ); + EXPECT_EQ ( 0, network_.NumberOfLoads() ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , RemoveLoadAtUsingVertexIdLoadIdExceptionHandling ) +{ + EXPECT_EQ ( 0, network_.NumberOfLoads() ); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "RemoveLoadAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// EXPECT_FALSE ( network_.HasLoad ( static_cast(0) ) ); -// EXPECT_EQ ( 0, network_.NumberOfLoads() ); -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.RemoveLoadAt ( static_cast(0) + , static_cast(0) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , RemoveLoadAtUsingVertexIdWhereLoadIdDoesNotExists ) -// { -// TVertexProperties vertexProperties; -// Types::vertexId vertexId = network_.Graph().AddVertex ( vertexProperties ); -// TVertex const & vertex = network_.Graph().VertexAt ( vertexId ); + assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "HasLoadAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); + try { + network_.HasLoadAt ( static_cast(0) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } -// EXPECT_EQ ( 0, network_.NumberOfLoads() ); + EXPECT_FALSE ( network_.HasLoad ( static_cast(0) ) ); + EXPECT_EQ ( 0, network_.NumberOfLoads() ); +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "RemoveLoadAt" -// , R"(HasLoad \( loadId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , RemoveLoadAtUsingVertexIdWhereLoadIdDoesNotExists ) +{ + TVertexProperties vertexProperties; + Types::vertexId vertexId = network_.Graph().AddVertex ( vertexProperties ); + TVertex const & vertex = network_.Graph().VertexAt ( vertexId ); -// ASSERT_DEATH ( {network_.RemoveLoadAt ( vertexId -// , static_cast(0) );} -// , assertionString ); -// EXPECT_EQ ( 0, network_.NumberOfLoads() ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , RemoveLoadAtUsingVertexIdWhereLoadIdDoesNotExistsExceptionHandling ) -// { -// TVertexProperties vertexProperties; -// Types::vertexId vertexId = network_.Graph().AddVertex ( vertexProperties ); -// TVertex const & vertex = network_.Graph().VertexAt ( vertexId ); + EXPECT_EQ ( 0, network_.NumberOfLoads() ); -// EXPECT_EQ ( 0, network_.NumberOfLoads() ); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "RemoveLoadAt" + , R"(HasLoad \( loadId \))"); -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "RemoveLoadAt" -// , R"(HasLoad \( loadId \))"); + ASSERT_DEATH ( {network_.RemoveLoadAt ( vertexId + , static_cast(0) );} + , assertionString ); + EXPECT_EQ ( 0, network_.NumberOfLoads() ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , RemoveLoadAtUsingVertexIdWhereLoadIdDoesNotExistsExceptionHandling ) +{ + TVertexProperties vertexProperties; + Types::vertexId vertexId = network_.Graph().AddVertex ( vertexProperties ); + TVertex const & vertex = network_.Graph().VertexAt ( vertexId ); -// try { -// network_.RemoveLoadAt ( vertexId -// , static_cast(0) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// EXPECT_EQ ( 0, network_.NumberOfLoads() ); -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + EXPECT_EQ ( 0, network_.NumberOfLoads() ); -// TEST_F ( TestNetworkEmptyDeathTest -// , RemoveLoadAtUsingVertexIdLoadIdAddingAndRemovingMultipleLoads ) -// { -// TVertexProperties vertexProperties; -// TLoadProperties loadProperties; - -// // Add vertex -// Types::vertexId vertexId = network_.Graph().AddVertex ( vertexProperties ); -// TVertex const & vertex = network_.Graph().VertexAt ( vertexId ); - -// EXPECT_FALSE ( network_.HasLoadAt ( vertex ) ); -// // Add multiple loads -// Types::loadId loadId0 = network_.AddLoadAt ( vertexId, loadProperties ); -// Types::loadId loadId1 = network_.AddLoadAt ( vertexId, loadProperties ); -// Types::loadId loadId2 = network_.AddLoadAt ( vertexId, loadProperties ); -// Types::loadId loadId3 = network_.AddLoadAt ( vertexId, loadProperties ); -// Types::loadId loadId4 = network_.AddLoadAt ( vertexId, loadProperties ); -// EXPECT_EQ ( 5, network_.NumberOfLoads() ) ; -// EXPECT_TRUE ( network_.HasLoadAt ( vertex ) ); -// EXPECT_TRUE ( network_.HasLoad ( loadId0 ) ); -// EXPECT_TRUE ( network_.HasLoad ( loadId1 ) ); -// EXPECT_TRUE ( network_.HasLoad ( loadId2 ) ); -// EXPECT_TRUE ( network_.HasLoad ( loadId3 ) ); -// EXPECT_TRUE ( network_.HasLoad ( loadId4 ) ); -// EXPECT_EQ ( 0, loadId0 ); -// EXPECT_EQ ( 1, loadId1 ); -// EXPECT_EQ ( 2, loadId2 ); -// EXPECT_EQ ( 3, loadId3 ); -// EXPECT_EQ ( 4, loadId4 ); -// // Remove some loads -// network_.RemoveLoadAt ( vertexId, loadId0 ); -// network_.RemoveLoadAt ( vertexId, loadId3 ); -// EXPECT_EQ ( 3, network_.NumberOfLoads() ) ; -// EXPECT_FALSE ( network_.HasLoad ( loadId0 ) ); -// EXPECT_TRUE ( network_.HasLoad ( loadId1 ) ); -// EXPECT_TRUE ( network_.HasLoad ( loadId2 ) ); -// EXPECT_FALSE ( network_.HasLoad ( loadId3 ) ); -// EXPECT_TRUE ( network_.HasLoad ( loadId4 ) ); -// // Remove the rest -// network_.RemoveLoadAt ( vertexId, loadId1 ); -// network_.RemoveLoadAt ( vertexId, loadId2 ); -// network_.RemoveLoadAt ( vertexId, loadId4 ); -// EXPECT_EQ ( 0, network_.NumberOfLoads() ) ; -// EXPECT_FALSE ( network_.HasLoadAt ( vertex ) ); -// } + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "RemoveLoadAt" + , R"(HasLoad \( loadId \))"); -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark HasLoadId -// // *********************************************************************** -// // *********************************************************************** + try { + network_.RemoveLoadAt ( vertexId + , static_cast(0) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } + EXPECT_EQ ( 0, network_.NumberOfLoads() ); +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmpty -// , HasLoadId ) -// { -// EXPECT_FALSE ( network_.HasLoad ( static_cast(0) ) ); -// EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(0) ) ); -// } +TEST_F ( TestNetworkEmptyDeathTest + , RemoveLoadAtUsingVertexIdLoadIdAddingAndRemovingMultipleLoads ) +{ + TVertexProperties vertexProperties; + TLoadProperties loadProperties; + + // Add vertex + Types::vertexId vertexId = network_.Graph().AddVertex ( vertexProperties ); + TVertex const & vertex = network_.Graph().VertexAt ( vertexId ); + + EXPECT_FALSE ( network_.HasLoadAt ( vertex ) ); + // Add multiple loads + Types::loadId loadId0 = network_.AddLoadAt ( vertexId, loadProperties ); + Types::loadId loadId1 = network_.AddLoadAt ( vertexId, loadProperties ); + Types::loadId loadId2 = network_.AddLoadAt ( vertexId, loadProperties ); + Types::loadId loadId3 = network_.AddLoadAt ( vertexId, loadProperties ); + Types::loadId loadId4 = network_.AddLoadAt ( vertexId, loadProperties ); + EXPECT_EQ ( 5, network_.NumberOfLoads() ) ; + EXPECT_TRUE ( network_.HasLoadAt ( vertex ) ); + EXPECT_TRUE ( network_.HasLoad ( loadId0 ) ); + EXPECT_TRUE ( network_.HasLoad ( loadId1 ) ); + EXPECT_TRUE ( network_.HasLoad ( loadId2 ) ); + EXPECT_TRUE ( network_.HasLoad ( loadId3 ) ); + EXPECT_TRUE ( network_.HasLoad ( loadId4 ) ); + EXPECT_EQ ( 0, loadId0 ); + EXPECT_EQ ( 1, loadId1 ); + EXPECT_EQ ( 2, loadId2 ); + EXPECT_EQ ( 3, loadId3 ); + EXPECT_EQ ( 4, loadId4 ); + // Remove some loads + network_.RemoveLoadAt ( vertexId, loadId0 ); + network_.RemoveLoadAt ( vertexId, loadId3 ); + EXPECT_EQ ( 3, network_.NumberOfLoads() ) ; + EXPECT_FALSE ( network_.HasLoad ( loadId0 ) ); + EXPECT_TRUE ( network_.HasLoad ( loadId1 ) ); + EXPECT_TRUE ( network_.HasLoad ( loadId2 ) ); + EXPECT_FALSE ( network_.HasLoad ( loadId3 ) ); + EXPECT_TRUE ( network_.HasLoad ( loadId4 ) ); + // Remove the rest + network_.RemoveLoadAt ( vertexId, loadId1 ); + network_.RemoveLoadAt ( vertexId, loadId2 ); + network_.RemoveLoadAt ( vertexId, loadId4 ); + EXPECT_EQ ( 0, network_.NumberOfLoads() ) ; + EXPECT_FALSE ( network_.HasLoadAt ( vertex ) ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , HasLoadId ) -// { // Checks loadId -// EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); -// EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); +// *********************************************************************** +// *********************************************************************** +#pragma mark HasLoadId +// *********************************************************************** +// *********************************************************************** -// EXPECT_FALSE ( network_.HasLoad ( static_cast(1) ) ); -// EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(1) ) ); +TEST_F ( TestNetworkEmpty + , HasLoadId ) +{ + EXPECT_FALSE ( network_.HasLoad ( static_cast(0) ) ); + EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(0) ) ); +} -// EXPECT_FALSE ( network_.HasLoad ( static_cast(2) ) ); -// EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(2) ) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , HasLoadId ) +{ // Checks loadId + EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); + EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); -// EXPECT_FALSE ( network_.HasLoad ( static_cast(3) ) ); -// EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(3) ) ); + EXPECT_FALSE ( network_.HasLoad ( static_cast(1) ) ); + EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(1) ) ); -// EXPECT_FALSE ( network_.HasLoad ( static_cast(9999) ) ); -// EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(9999) ) ); -// } + EXPECT_FALSE ( network_.HasLoad ( static_cast(2) ) ); + EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(2) ) ); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , HasLoadId ) -// { // Checks loadId -// EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); -// EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); + EXPECT_FALSE ( network_.HasLoad ( static_cast(3) ) ); + EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(3) ) ); -// EXPECT_FALSE ( network_.HasLoad ( static_cast(1) ) ); -// EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(1) ) ); + EXPECT_FALSE ( network_.HasLoad ( static_cast(9999) ) ); + EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(9999) ) ); +} -// EXPECT_FALSE ( network_.HasLoad ( static_cast(2) ) ); -// EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(2) ) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , HasLoadId ) +{ // Checks loadId + EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); + EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); -// EXPECT_FALSE ( network_.HasLoad ( static_cast(3) ) ); -// EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(3) ) ); + EXPECT_FALSE ( network_.HasLoad ( static_cast(1) ) ); + EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(1) ) ); -// EXPECT_FALSE ( network_.HasLoad ( static_cast(9999) ) ); -// EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(9999) ) ); -// } + EXPECT_FALSE ( network_.HasLoad ( static_cast(2) ) ); + EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(2) ) ); -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark HasLoadObject -// // *********************************************************************** -// // *********************************************************************** + EXPECT_FALSE ( network_.HasLoad ( static_cast(3) ) ); + EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(3) ) ); -// TEST_F ( TestNetworkEmpty -// , HasLoadObject ) -// { -// TLoadProperties loadProperties; -// EXPECT_FALSE ( network_.HasLoad ( loadProperties ) ); -// EXPECT_FALSE ( networkConst_.HasLoad ( loadProperties ) ); -// } + EXPECT_FALSE ( network_.HasLoad ( static_cast(9999) ) ); + EXPECT_FALSE ( networkConst_.HasLoad ( static_cast(9999) ) ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , HasLoadObject ) -// { // Checks loadObject -// TLoadProperties loadProperties0; -// EXPECT_FALSE ( network_.HasLoad ( loadProperties0 ) ); -// EXPECT_FALSE ( networkConst_.HasLoad ( loadProperties0 ) ); - -// EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); -// EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); -// TLoadProperties loadProperties1 = network_.LoadAt( 0 ); -// EXPECT_TRUE ( network_.HasLoad ( loadProperties1 ) ); -// EXPECT_TRUE ( networkConst_.HasLoad ( loadProperties1 ) ); -// } +// *********************************************************************** +// *********************************************************************** +#pragma mark HasLoadObject +// *********************************************************************** +// *********************************************************************** -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , HasLoadObject ) -// { // Checks loadObject -// TLoadProperties loadProperties0; -// EXPECT_FALSE ( network_.HasLoad ( loadProperties0 ) ); -// EXPECT_FALSE ( networkConst_.HasLoad ( loadProperties0 ) ); +TEST_F ( TestNetworkEmpty + , HasLoadObject ) +{ + TLoadProperties loadProperties; + EXPECT_FALSE ( network_.HasLoad ( loadProperties ) ); + EXPECT_FALSE ( networkConst_.HasLoad ( loadProperties ) ); +} -// EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); -// EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , HasLoadObject ) +{ // Checks loadObject + TLoadProperties loadProperties0; + EXPECT_FALSE ( network_.HasLoad ( loadProperties0 ) ); + EXPECT_FALSE ( networkConst_.HasLoad ( loadProperties0 ) ); + + EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); + EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); + TLoadProperties loadProperties1 = network_.LoadAt( 0 ); + EXPECT_TRUE ( network_.HasLoad ( loadProperties1 ) ); + EXPECT_TRUE ( networkConst_.HasLoad ( loadProperties1 ) ); +} -// TLoadProperties loadProperties1 = network_.LoadAt( 0 ); -// EXPECT_TRUE ( network_.HasLoad ( loadProperties1 ) ); -// EXPECT_TRUE ( networkConst_.HasLoad ( loadProperties1 ) ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , HasLoadObject ) +{ // Checks loadObject + TLoadProperties loadProperties0; + EXPECT_FALSE ( network_.HasLoad ( loadProperties0 ) ); + EXPECT_FALSE ( networkConst_.HasLoad ( loadProperties0 ) ); -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark HasLoadAt -// // *********************************************************************** -// // *********************************************************************** + EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); + EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , HasLoadAt ) -// { // Checks if there is a load at a vertex + TLoadProperties loadProperties1 = network_.LoadAt( 0 ); + EXPECT_TRUE ( network_.HasLoad ( loadProperties1 ) ); + EXPECT_TRUE ( networkConst_.HasLoad ( loadProperties1 ) ); +} -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "HasLoadAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); +// *********************************************************************** +// *********************************************************************** +#pragma mark HasLoadAt +// *********************************************************************** +// *********************************************************************** -// ASSERT_DEATH ( {network_.HasLoadAt ( static_cast(0) );} -// , assertionString ); -// ASSERT_DEATH ( {networkConst_.HasLoadAt ( static_cast(0) );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , HasLoadAtExceptionHandling ) -// { // Checks if there is a load at a vertex +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , HasLoadAt ) +{ // Checks if there is a load at a vertex -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "HasLoadAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "HasLoadAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.HasLoadAt ( static_cast(0) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// try { -// networkConst_.HasLoadAt ( static_cast(0) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + ASSERT_DEATH ( {network_.HasLoadAt ( static_cast(0) );} + , assertionString ); + ASSERT_DEATH ( {networkConst_.HasLoadAt ( static_cast(0) );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , HasLoadAtExceptionHandling ) +{ // Checks if there is a load at a vertex -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , HasLoadAt ) -// { // Checks if there is a load at a vertex -// EXPECT_FALSE ( network_.HasLoadAt ( static_cast(0) ) ); -// EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(0) ) ); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "HasLoadAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); -// EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(1) ) ); + try { + network_.HasLoadAt ( static_cast(0) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } + try { + networkConst_.HasLoadAt ( static_cast(0) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// EXPECT_FALSE ( network_.HasLoadAt ( static_cast(2) ) ); -// EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(2) ) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , HasLoadAt ) +{ // Checks if there is a load at a vertex + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(0) ) ); + EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(0) ) ); -// EXPECT_TRUE ( network_.HasLoadAt ( static_cast(3) ) ); -// EXPECT_TRUE ( networkConst_.HasLoadAt ( static_cast(3) ) ); -// } + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); + EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(1) ) ); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , HasLoadAt ) -// { // Checks if there is a load at a vertex -// EXPECT_FALSE ( network_.HasLoadAt ( static_cast(0) ) ); -// EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(0) ) ); + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(2) ) ); + EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(2) ) ); -// EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); -// EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(1) ) ); + EXPECT_TRUE ( network_.HasLoadAt ( static_cast(3) ) ); + EXPECT_TRUE ( networkConst_.HasLoadAt ( static_cast(3) ) ); +} -// EXPECT_FALSE ( network_.HasLoadAt ( static_cast(2) ) ); -// EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(2) ) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , HasLoadAt ) +{ // Checks if there is a load at a vertex + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(0) ) ); + EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(0) ) ); -// EXPECT_TRUE ( network_.HasLoadAt ( static_cast(3) ) ); -// EXPECT_TRUE ( networkConst_.HasLoadAt ( static_cast(3) ) ); -// } + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); + EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(1) ) ); -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark LoadId -// // *********************************************************************** -// // *********************************************************************** + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(2) ) ); + EXPECT_FALSE ( networkConst_.HasLoadAt ( static_cast(2) ) ); -// TEST_F ( TestNetworkEmptyDeathTest -// , LoadId ) -// { // Checks if there is a load at a vertex + EXPECT_TRUE ( network_.HasLoadAt ( static_cast(3) ) ); + EXPECT_TRUE ( networkConst_.HasLoadAt ( static_cast(3) ) ); +} -// TLoadProperties loadProperties0; +// *********************************************************************** +// *********************************************************************** +#pragma mark LoadId +// *********************************************************************** +// *********************************************************************** -// EXPECT_EQ ( Const::NONE, network_.LoadId ( loadProperties0 ) ); -// EXPECT_EQ ( Const::NONE, networkConst_.LoadId ( loadProperties0 ) ); -// } +TEST_F ( TestNetworkEmptyDeathTest + , LoadId ) +{ // Checks if there is a load at a vertex -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , LoadId ) -// { // Checks if there is a load at a vertex -// TLoadProperties loadProperties0; -// EXPECT_EQ ( Const::NONE, network_.LoadId ( loadProperties0 ) ); -// EXPECT_EQ ( Const::NONE, networkConst_.LoadId ( loadProperties0 ) ); + TLoadProperties loadProperties0; -// EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); -// EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); + EXPECT_EQ ( Const::NONE, network_.LoadId ( loadProperties0 ) ); + EXPECT_EQ ( Const::NONE, networkConst_.LoadId ( loadProperties0 ) ); +} -// TLoadProperties loadProperties1 = network_.LoadAt( 0 ); -// EXPECT_EQ ( 0, network_.LoadId ( loadProperties1 ) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , LoadId ) +{ // Checks if there is a load at a vertex + TLoadProperties loadProperties0; + EXPECT_EQ ( Const::NONE, network_.LoadId ( loadProperties0 ) ); + EXPECT_EQ ( Const::NONE, networkConst_.LoadId ( loadProperties0 ) ); -// loadProperties1 = networkConst_.LoadAt( 0 ); -// EXPECT_EQ ( 0, networkConst_.LoadId ( loadProperties1 ) ); -// } + EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); + EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , LoadId ) -// { // Checks if there is a load at a vertex -// TLoadProperties loadProperties0; -// EXPECT_EQ ( Const::NONE, network_.LoadId ( loadProperties0 ) ); -// EXPECT_EQ ( Const::NONE, networkConst_.LoadId ( loadProperties0 ) ); + TLoadProperties loadProperties1 = network_.LoadAt( 0 ); + EXPECT_EQ ( 0, network_.LoadId ( loadProperties1 ) ); -// EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); -// EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); + loadProperties1 = networkConst_.LoadAt( 0 ); + EXPECT_EQ ( 0, networkConst_.LoadId ( loadProperties1 ) ); +} -// TLoadProperties loadProperties1 = network_.LoadAt( 0 ); -// EXPECT_EQ ( 0, network_.LoadId ( loadProperties1 ) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , LoadId ) +{ // Checks if there is a load at a vertex + TLoadProperties loadProperties0; + EXPECT_EQ ( Const::NONE, network_.LoadId ( loadProperties0 ) ); + EXPECT_EQ ( Const::NONE, networkConst_.LoadId ( loadProperties0 ) ); -// loadProperties1 = networkConst_.LoadAt( 0 ); -// EXPECT_EQ ( 0, networkConst_.LoadId ( loadProperties1 ) ); -// } + EXPECT_TRUE ( network_.HasLoad ( static_cast(0) ) ); + EXPECT_TRUE ( networkConst_.HasLoad ( static_cast(0) ) ); -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark LoadIds -// // *********************************************************************** -// // *********************************************************************** + TLoadProperties loadProperties1 = network_.LoadAt( 0 ); + EXPECT_EQ ( 0, network_.LoadId ( loadProperties1 ) ); -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , LoadIds ) -// { // Checks if there is a load at a vertex + loadProperties1 = networkConst_.LoadAt( 0 ); + EXPECT_EQ ( 0, networkConst_.LoadId ( loadProperties1 ) ); +} -// TLoadProperties loadProperties0; -// std::vector loadIds; +// *********************************************************************** +// *********************************************************************** +#pragma mark LoadIds +// *********************************************************************** +// *********************************************************************** -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "LoadIds" -// , R"(Graph\(\).VertexExists\( vertexId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , LoadIds ) +{ // Checks if there is a load at a vertex -// ASSERT_DEATH ( {network_.LoadIds ( static_cast( 0 ), loadIds );} -// , assertionString ); -// ASSERT_DEATH ( {networkConst_.LoadIds ( static_cast( 0 ), loadIds );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , LoadIdsExceptionHandling ) -// { // Checks if there is a load at a vertex + TLoadProperties loadProperties0; + std::vector loadIds; -// TLoadProperties loadProperties0; -// std::vector loadIds; + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "LoadIds" + , R"(Graph\(\).VertexExists\( vertexId \))"); -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "LoadIds" -// , R"(Graph\(\).VertexExists\( vertexId \))"); + ASSERT_DEATH ( {network_.LoadIds ( static_cast( 0 ), loadIds );} + , assertionString ); + ASSERT_DEATH ( {networkConst_.LoadIds ( static_cast( 0 ), loadIds );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , LoadIdsExceptionHandling ) +{ // Checks if there is a load at a vertex -// try { -// network_.LoadIds ( static_cast( 0 ), loadIds ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } + TLoadProperties loadProperties0; + std::vector loadIds; -// try { -// networkConst_.LoadIds ( static_cast( 0 ), loadIds ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "LoadIds" + , R"(Graph\(\).VertexExists\( vertexId \))"); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , LoadIds ) -// { // Checks if there is a load at a vertex -// TLoadProperties loadProperties0; -// std::vector loadIds; - -// network_.LoadIds ( static_cast( 0 ), loadIds ); -// EXPECT_EQ ( 0, loadIds.size() ); -// networkConst_.LoadIds ( static_cast( 0 ), loadIds ); -// EXPECT_EQ ( 0, loadIds.size() ); - -// network_.LoadIds ( static_cast( 1 ), loadIds ); -// EXPECT_EQ ( 0, loadIds.size() ); -// networkConst_.LoadIds ( static_cast( 1 ), loadIds ); -// EXPECT_EQ ( 0, loadIds.size() ); - -// network_.LoadIds ( static_cast( 2 ), loadIds ); -// EXPECT_EQ ( 0, loadIds.size() ); -// networkConst_.LoadIds ( static_cast( 2 ), loadIds ); -// EXPECT_EQ ( 0, loadIds.size() ); - -// network_.LoadIds ( static_cast( 3 ), loadIds ); -// EXPECT_EQ ( 1, loadIds.size() ); -// loadIds.clear(); -// networkConst_.LoadIds ( static_cast( 3 ), loadIds ); -// EXPECT_EQ ( 1, loadIds.size() ); -// } + try { + network_.LoadIds ( static_cast( 0 ), loadIds ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , LoadIds ) -// { // Checks if there is a load at a vertex -// TLoadProperties loadProperties0; -// std::vector loadIds; - -// network_.LoadIds ( static_cast( 0 ), loadIds ); -// EXPECT_EQ ( 0, loadIds.size() ); -// networkConst_.LoadIds ( static_cast( 0 ), loadIds ); -// EXPECT_EQ ( 0, loadIds.size() ); - -// network_.LoadIds ( static_cast( 1 ), loadIds ); -// EXPECT_EQ ( 0, loadIds.size() ); -// networkConst_.LoadIds ( static_cast( 1 ), loadIds ); -// EXPECT_EQ ( 0, loadIds.size() ); - -// network_.LoadIds ( static_cast( 2 ), loadIds ); -// EXPECT_EQ ( 0, loadIds.size() ); -// networkConst_.LoadIds ( static_cast( 2 ), loadIds ); -// EXPECT_EQ ( 0, loadIds.size() ); - -// network_.LoadIds ( static_cast( 3 ), loadIds ); -// EXPECT_EQ ( 1, loadIds.size() ); -// loadIds.clear(); -// networkConst_.LoadIds ( static_cast( 3 ), loadIds ); -// EXPECT_EQ ( 1, loadIds.size() ); -// } + try { + networkConst_.LoadIds ( static_cast( 0 ), loadIds ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark LoadAt -// // *********************************************************************** -// // *********************************************************************** +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , LoadIds ) +{ // Checks if there is a load at a vertex + TLoadProperties loadProperties0; + std::vector loadIds; + + network_.LoadIds ( static_cast( 0 ), loadIds ); + EXPECT_EQ ( 0, loadIds.size() ); + networkConst_.LoadIds ( static_cast( 0 ), loadIds ); + EXPECT_EQ ( 0, loadIds.size() ); + + network_.LoadIds ( static_cast( 1 ), loadIds ); + EXPECT_EQ ( 0, loadIds.size() ); + networkConst_.LoadIds ( static_cast( 1 ), loadIds ); + EXPECT_EQ ( 0, loadIds.size() ); + + network_.LoadIds ( static_cast( 2 ), loadIds ); + EXPECT_EQ ( 0, loadIds.size() ); + networkConst_.LoadIds ( static_cast( 2 ), loadIds ); + EXPECT_EQ ( 0, loadIds.size() ); + + network_.LoadIds ( static_cast( 3 ), loadIds ); + EXPECT_EQ ( 1, loadIds.size() ); + loadIds.clear(); + networkConst_.LoadIds ( static_cast( 3 ), loadIds ); + EXPECT_EQ ( 1, loadIds.size() ); +} -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , LoadAt ) -// { // Checks if there is a load at a load ID -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "LoadAt" -// , R"(HasLoad \( loadId \))"); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , LoadIds ) +{ // Checks if there is a load at a vertex + TLoadProperties loadProperties0; + std::vector loadIds; + + network_.LoadIds ( static_cast( 0 ), loadIds ); + EXPECT_EQ ( 0, loadIds.size() ); + networkConst_.LoadIds ( static_cast( 0 ), loadIds ); + EXPECT_EQ ( 0, loadIds.size() ); + + network_.LoadIds ( static_cast( 1 ), loadIds ); + EXPECT_EQ ( 0, loadIds.size() ); + networkConst_.LoadIds ( static_cast( 1 ), loadIds ); + EXPECT_EQ ( 0, loadIds.size() ); + + network_.LoadIds ( static_cast( 2 ), loadIds ); + EXPECT_EQ ( 0, loadIds.size() ); + networkConst_.LoadIds ( static_cast( 2 ), loadIds ); + EXPECT_EQ ( 0, loadIds.size() ); + + network_.LoadIds ( static_cast( 3 ), loadIds ); + EXPECT_EQ ( 1, loadIds.size() ); + loadIds.clear(); + networkConst_.LoadIds ( static_cast( 3 ), loadIds ); + EXPECT_EQ ( 1, loadIds.size() ); +} -// ASSERT_DEATH ( {network_.LoadAt ( static_cast( 0 ) );} -// , assertionString ); -// ASSERT_DEATH ( {networkConst_.LoadAt ( static_cast( 0 ) );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , LoadAtExceptionHandling ) -// { // Checks if there is a load at a load ID -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "LoadAt" -// , R"(HasLoad \( loadId \))"); +// *********************************************************************** +// *********************************************************************** +#pragma mark LoadAt +// *********************************************************************** +// *********************************************************************** -// try { -// network_.LoadAt ( static_cast( 0 ) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// try { -// networkConst_.LoadAt ( static_cast( 0 ) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , LoadAt ) +{ // Checks if there is a load at a load ID + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "LoadAt" + , R"(HasLoad \( loadId \))"); -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest -// , LoadAt ) -// { // Checks if there is a load at a load ID and returns the property -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "LoadAt" -// , R"(HasLoad \( loadId \))"); + ASSERT_DEATH ( {network_.LoadAt ( static_cast( 0 ) );} + , assertionString ); + ASSERT_DEATH ( {networkConst_.LoadAt ( static_cast( 0 ) );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , LoadAtExceptionHandling ) +{ // Checks if there is a load at a load ID + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "LoadAt" + , R"(HasLoad \( loadId \))"); -// ASSERT_DEATH ( {network_.LoadAt ( static_cast( 3 ) );} -// , assertionString ); -// ASSERT_DEATH ( {networkConst_.LoadAt ( static_cast( 3 ) );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , LoadAtExceptionHandling ) -// { // Checks if there is a load at a load ID and returns the property -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "LoadAt" -// , R"(HasLoad \( loadId \))"); + try { + network_.LoadAt ( static_cast( 0 ) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } + try { + networkConst_.LoadAt ( static_cast( 0 ) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// try { -// network_.LoadAt ( static_cast( 3 ) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// try { -// networkConst_.LoadAt ( static_cast( 3 ) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest + , LoadAt ) +{ // Checks if there is a load at a load ID and returns the property + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "LoadAt" + , R"(HasLoad \( loadId \))"); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , LoadAt ) -// { // Checks if there is a load at a load ID and returns the property -// TLoadProperties loadProperties0 = network_.LoadAt ( static_cast( 0 ) ); - -// EXPECT_EQ ( "4", loadProperties0.Name() ); -// EXPECT_EQ ( Vertices::IeeeBusType::load, loadProperties0.Type() ); -// EXPECT_EQ ( 8.0, loadProperties0.RealPowerLoad() ); -// EXPECT_EQ ( 0.0, loadProperties0.RealPowerLoadBound().Minimum() ); -// EXPECT_EQ ( 8.0, loadProperties0.RealPowerLoadBound().Maximum() ); -// EXPECT_EQ ( 1.1, loadProperties0.ReactivePowerLoad() ); -// EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoadBound().Minimum() ); -// EXPECT_EQ ( 1.1, loadProperties0.ReactivePowerLoadBound().Maximum() ); - -// loadProperties0 = networkConst_.LoadAt ( static_cast( 0 ) ); - -// EXPECT_EQ ( "4", loadProperties0.Name() ); -// EXPECT_EQ ( Vertices::IeeeBusType::load, loadProperties0.Type() ); -// EXPECT_EQ ( 8.0, loadProperties0.RealPowerLoad() ); -// EXPECT_EQ ( 0.0, loadProperties0.RealPowerLoadBound().Minimum() ); -// EXPECT_EQ ( 8.0, loadProperties0.RealPowerLoadBound().Maximum() ); -// EXPECT_EQ ( 1.1, loadProperties0.ReactivePowerLoad() ); -// EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoadBound().Minimum() ); -// EXPECT_EQ ( 1.1, loadProperties0.ReactivePowerLoadBound().Maximum() ); -// } + ASSERT_DEATH ( {network_.LoadAt ( static_cast( 3 ) );} + , assertionString ); + ASSERT_DEATH ( {networkConst_.LoadAt ( static_cast( 3 ) );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , LoadAtExceptionHandling ) +{ // Checks if there is a load at a load ID and returns the property + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "LoadAt" + , R"(HasLoad \( loadId \))"); -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4bDeathTest -// , LoadAt ) -// { // Checks if there is a load at a load ID and returns the property -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "LoadAt" -// , R"(HasLoad \( loadId \))"); + try { + network_.LoadAt ( static_cast( 3 ) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } + try { + networkConst_.LoadAt ( static_cast( 3 ) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// ASSERT_DEATH ( {network_.LoadAt ( static_cast( 3 ) );} -// , assertionString ); -// ASSERT_DEATH ( {networkConst_.LoadAt ( static_cast( 3 ) );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , LoadAtExceptionHandling ) -// { // Checks if there is a load at a load ID and returns the property -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "LoadAt" -// , R"(HasLoad \( loadId \))"); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , LoadAt ) +{ // Checks if there is a load at a load ID and returns the property + TLoadProperties loadProperties0 = network_.LoadAt ( static_cast( 0 ) ); + + EXPECT_EQ ( "4", loadProperties0.Name() ); + EXPECT_EQ ( Vertices::IeeeBusType::load, loadProperties0.Type() ); + EXPECT_EQ ( 8.0, loadProperties0.RealPowerLoad() ); + EXPECT_EQ ( 0.0, loadProperties0.RealPowerLoadBound().Minimum() ); + EXPECT_EQ ( 8.0, loadProperties0.RealPowerLoadBound().Maximum() ); + EXPECT_EQ ( 1.1, loadProperties0.ReactivePowerLoad() ); + EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoadBound().Minimum() ); + EXPECT_EQ ( 1.1, loadProperties0.ReactivePowerLoadBound().Maximum() ); + + loadProperties0 = networkConst_.LoadAt ( static_cast( 0 ) ); + + EXPECT_EQ ( "4", loadProperties0.Name() ); + EXPECT_EQ ( Vertices::IeeeBusType::load, loadProperties0.Type() ); + EXPECT_EQ ( 8.0, loadProperties0.RealPowerLoad() ); + EXPECT_EQ ( 0.0, loadProperties0.RealPowerLoadBound().Minimum() ); + EXPECT_EQ ( 8.0, loadProperties0.RealPowerLoadBound().Maximum() ); + EXPECT_EQ ( 1.1, loadProperties0.ReactivePowerLoad() ); + EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoadBound().Minimum() ); + EXPECT_EQ ( 1.1, loadProperties0.ReactivePowerLoadBound().Maximum() ); +} -// try { -// network_.LoadAt ( static_cast( 3 ) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// try { -// networkConst_.LoadAt ( static_cast( 3 ) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestPowerGridAcm2018MtsfFigure4bDeathTest + , LoadAt ) +{ // Checks if there is a load at a load ID and returns the property + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "LoadAt" + , R"(HasLoad \( loadId \))"); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , LoadAt ) -// { // Checks if there is a load at a load ID and returns the property -// TLoadProperties loadProperties0 = network_.LoadAt ( static_cast( 0 ) ); - -// EXPECT_EQ ( "4", loadProperties0.Name() ); -// EXPECT_EQ ( Vertices::IeeeBusType::load, loadProperties0.Type() ); -// EXPECT_EQ ( 5.0, loadProperties0.RealPowerLoad() ); -// EXPECT_EQ ( 0.0, loadProperties0.RealPowerLoadBound().Minimum() ); -// EXPECT_EQ ( 5.0, loadProperties0.RealPowerLoadBound().Maximum() ); -// EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoad() ); -// EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoadBound().Minimum() ); -// EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoadBound().Maximum() ); - -// loadProperties0 = networkConst_.LoadAt ( static_cast( 0 ) ); - -// EXPECT_EQ ( "4", loadProperties0.Name() ); -// EXPECT_EQ ( Vertices::IeeeBusType::load, loadProperties0.Type() ); -// EXPECT_EQ ( 5.0, loadProperties0.RealPowerLoad() ); -// EXPECT_EQ ( 0.0, loadProperties0.RealPowerLoadBound().Minimum() ); -// EXPECT_EQ ( 5.0, loadProperties0.RealPowerLoadBound().Maximum() ); -// EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoad() ); -// EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoadBound().Minimum() ); -// EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoadBound().Maximum() ); -// } + ASSERT_DEATH ( {network_.LoadAt ( static_cast( 3 ) );} + , assertionString ); + ASSERT_DEATH ( {networkConst_.LoadAt ( static_cast( 3 ) );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , LoadAtExceptionHandling ) +{ // Checks if there is a load at a load ID and returns the property + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "LoadAt" + , R"(HasLoad \( loadId \))"); -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark LoadsAtVertexId -// // *********************************************************************** -// // *********************************************************************** + try { + network_.LoadAt ( static_cast( 3 ) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } + try { + networkConst_.LoadAt ( static_cast( 3 ) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , LoadsAtVertexId ) -// { // Return load properties at a vertex ID -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "LoadsAt" -// , R"(Graph\(\).VertexExists\( vertexId \))"); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , LoadAt ) +{ // Checks if there is a load at a load ID and returns the property + TLoadProperties loadProperties0 = network_.LoadAt ( static_cast( 0 ) ); + + EXPECT_EQ ( "4", loadProperties0.Name() ); + EXPECT_EQ ( Vertices::IeeeBusType::load, loadProperties0.Type() ); + EXPECT_EQ ( 5.0, loadProperties0.RealPowerLoad() ); + EXPECT_EQ ( 0.0, loadProperties0.RealPowerLoadBound().Minimum() ); + EXPECT_EQ ( 5.0, loadProperties0.RealPowerLoadBound().Maximum() ); + EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoad() ); + EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoadBound().Minimum() ); + EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoadBound().Maximum() ); + + loadProperties0 = networkConst_.LoadAt ( static_cast( 0 ) ); + + EXPECT_EQ ( "4", loadProperties0.Name() ); + EXPECT_EQ ( Vertices::IeeeBusType::load, loadProperties0.Type() ); + EXPECT_EQ ( 5.0, loadProperties0.RealPowerLoad() ); + EXPECT_EQ ( 0.0, loadProperties0.RealPowerLoadBound().Minimum() ); + EXPECT_EQ ( 5.0, loadProperties0.RealPowerLoadBound().Maximum() ); + EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoad() ); + EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoadBound().Minimum() ); + EXPECT_EQ ( 0.0, loadProperties0.ReactivePowerLoadBound().Maximum() ); +} -// std::vector loads; -// ASSERT_DEATH ( {network_.LoadsAt ( static_cast( 0 ), loads );} -// , assertionString ); +// *********************************************************************** +// *********************************************************************** +#pragma mark LoadsAtVertexId +// *********************************************************************** +// *********************************************************************** -// ASSERT_DEATH ( {networkConst_.LoadsAt ( static_cast( 0 ), loads );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , LoadsAtVertexIdExceptionHandling ) -// { // Return load properties at a vertex ID -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "LoadsAt" -// , R"(Graph\(\).VertexExists\( vertexId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , LoadsAtVertexId ) +{ // Return load properties at a vertex ID + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "LoadsAt" + , R"(Graph\(\).VertexExists\( vertexId \))"); -// std::vector loads; -// try { -// network_.LoadsAt ( static_cast( 0 ), loads ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// try { -// networkConst_.LoadsAt ( static_cast( 0 ), loads ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + std::vector loads; + ASSERT_DEATH ( {network_.LoadsAt ( static_cast( 0 ), loads );} + , assertionString ); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , LoadsAtVertexId ) -// { // Return load properties at a vertex ID -// std::vector multipleLoadProperties; - -// network_.LoadsAt ( static_cast( 0 ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); -// networkConst_.LoadsAt ( static_cast( 0 ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); - -// network_.LoadsAt ( static_cast( 1 ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); -// networkConst_.LoadsAt ( static_cast( 1 ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); - -// network_.LoadsAt ( static_cast( 2 ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); -// networkConst_.LoadsAt ( static_cast( 2 ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); - -// network_.LoadsAt ( static_cast( 3 ), multipleLoadProperties ); -// EXPECT_EQ ( 1, multipleLoadProperties.size() ); - -// EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); -// EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); -// EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); -// EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); -// EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); -// EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); -// multipleLoadProperties.clear(); - -// networkConst_.LoadsAt ( static_cast( 3 ), multipleLoadProperties ); -// EXPECT_EQ ( 1, multipleLoadProperties.size() ); - -// EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); -// EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); -// EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); -// EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); -// EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); -// EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); -// } + ASSERT_DEATH ( {networkConst_.LoadsAt ( static_cast( 0 ), loads );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , LoadsAtVertexIdExceptionHandling ) +{ // Return load properties at a vertex ID + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "LoadsAt" + , R"(Graph\(\).VertexExists\( vertexId \))"); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , LoadsAtVertexId ) -// { // Return load properties at a vertex ID -// std::vector multipleLoadProperties; - -// network_.LoadsAt ( static_cast( 0 ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); -// networkConst_.LoadsAt ( static_cast( 0 ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); - -// network_.LoadsAt ( static_cast( 1 ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); -// networkConst_.LoadsAt ( static_cast( 1 ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); - -// network_.LoadsAt ( static_cast( 2 ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); -// networkConst_.LoadsAt ( static_cast( 2 ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); - -// network_.LoadsAt ( static_cast( 3 ), multipleLoadProperties ); -// EXPECT_EQ ( 1, multipleLoadProperties.size() ); - -// EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); -// EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); -// EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); -// EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); -// multipleLoadProperties.clear(); - -// networkConst_.LoadsAt ( static_cast( 3 ), multipleLoadProperties ); -// EXPECT_EQ ( 1, multipleLoadProperties.size() ); - -// EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); -// EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); -// EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); -// EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); -// } + std::vector loads; + try { + network_.LoadsAt ( static_cast( 0 ), loads ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } + try { + networkConst_.LoadsAt ( static_cast( 0 ), loads ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark LoadsAtVertex -// // *********************************************************************** -// // *********************************************************************** +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , LoadsAtVertexId ) +{ // Return load properties at a vertex ID + std::vector multipleLoadProperties; + + network_.LoadsAt ( static_cast( 0 ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + networkConst_.LoadsAt ( static_cast( 0 ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + + network_.LoadsAt ( static_cast( 1 ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + networkConst_.LoadsAt ( static_cast( 1 ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + + network_.LoadsAt ( static_cast( 2 ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + networkConst_.LoadsAt ( static_cast( 2 ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + + network_.LoadsAt ( static_cast( 3 ), multipleLoadProperties ); + EXPECT_EQ ( 1, multipleLoadProperties.size() ); + + EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); + EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); + EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); + EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); + EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); + EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); + multipleLoadProperties.clear(); + + networkConst_.LoadsAt ( static_cast( 3 ), multipleLoadProperties ); + EXPECT_EQ ( 1, multipleLoadProperties.size() ); + + EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); + EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); + EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); + EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); + EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); + EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); +} -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , LoadsAtVertex ) -// { // Return load properties at a vertex ID -// auto assertionString = buildAssertionString ( "StaticGraph.hpp" -// , "StaticGraph" -// , "VertexAt" -// , R"(VertexExists\(id\))"); - -// std::vector loads; -// ASSERT_DEATH ( {network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 0 ) ), loads );} -// , assertionString ); -// ASSERT_DEATH ( {networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 0 ) ), loads );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , LoadsAtVertexExceptionHandling ) -// { // Return load properties at a vertex ID -// auto assertionString = buildAssertionString ( "StaticGraph.hpp" -// , "StaticGraph" -// , "VertexAt" -// , R"(VertexExists\(id\))"); - -// std::vector loads; -// try { -// network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 0 ) ), loads ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , LoadsAtVertexId ) +{ // Return load properties at a vertex ID + std::vector multipleLoadProperties; + + network_.LoadsAt ( static_cast( 0 ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + networkConst_.LoadsAt ( static_cast( 0 ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + + network_.LoadsAt ( static_cast( 1 ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + networkConst_.LoadsAt ( static_cast( 1 ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + + network_.LoadsAt ( static_cast( 2 ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + networkConst_.LoadsAt ( static_cast( 2 ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + + network_.LoadsAt ( static_cast( 3 ), multipleLoadProperties ); + EXPECT_EQ ( 1, multipleLoadProperties.size() ); + + EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); + EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); + EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); + EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); + multipleLoadProperties.clear(); + + networkConst_.LoadsAt ( static_cast( 3 ), multipleLoadProperties ); + EXPECT_EQ ( 1, multipleLoadProperties.size() ); + + EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); + EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); + EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); + EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); +} -// try { -// networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 0 ) ), loads ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION +// *********************************************************************** +// *********************************************************************** +#pragma mark LoadsAtVertex +// *********************************************************************** +// *********************************************************************** -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , LoadsAtVertex ) -// { // Return load properties at a vertex ID -// std::vector multipleLoadProperties; - -// network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 0 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); -// networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 0 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); - -// network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 1 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); -// networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 1 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); - -// network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 2 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); -// networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 2 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); - -// network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 3 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 1, multipleLoadProperties.size() ); - -// EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); -// EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); -// EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); -// EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); -// EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); -// EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); -// multipleLoadProperties.clear(); - -// networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 3 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 1, multipleLoadProperties.size() ); - -// EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); -// EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); -// EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); -// EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); -// EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); -// EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); -// } +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , LoadsAtVertex ) +{ // Return load properties at a vertex ID + auto assertionString = buildAssertionString ( "StaticGraph.hpp" + , "StaticGraph" + , "VertexAt" + , R"(VertexExists\(id\))"); + + std::vector loads; + ASSERT_DEATH ( {network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 0 ) ), loads );} + , assertionString ); + ASSERT_DEATH ( {networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 0 ) ), loads );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , LoadsAtVertexExceptionHandling ) +{ // Return load properties at a vertex ID + auto assertionString = buildAssertionString ( "StaticGraph.hpp" + , "StaticGraph" + , "VertexAt" + , R"(VertexExists\(id\))"); + + std::vector loads; + try { + network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 0 ) ), loads ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , LoadsAtVertex ) -// { // Return load properties at a vertex ID -// std::vector multipleLoadProperties; - -// network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 0 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); -// networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 0 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); - -// network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 1 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); -// networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 1 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); - -// network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 2 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); -// networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 2 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 0, multipleLoadProperties.size() ); - -// network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 3 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 1, multipleLoadProperties.size() ); -// EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); -// EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); -// EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); -// EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); -// multipleLoadProperties.clear(); - -// networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 3 ) ), multipleLoadProperties ); -// EXPECT_EQ ( 1, multipleLoadProperties.size() ); - -// EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); -// EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); -// EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); -// EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoad() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); -// EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); -// } + try { + networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 0 ) ), loads ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark RealPowerLoadAt -// // *********************************************************************** -// // *********************************************************************** +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , LoadsAtVertex ) +{ // Return load properties at a vertex ID + std::vector multipleLoadProperties; + + network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 0 ) ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 0 ) ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + + network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 1 ) ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 1 ) ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + + network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 2 ) ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 2 ) ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + + network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 3 ) ), multipleLoadProperties ); + EXPECT_EQ ( 1, multipleLoadProperties.size() ); + + EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); + EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); + EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); + EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); + EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); + EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); + multipleLoadProperties.clear(); + + networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 3 ) ), multipleLoadProperties ); + EXPECT_EQ ( 1, multipleLoadProperties.size() ); + + EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); + EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); + EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); + EXPECT_EQ ( 8.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); + EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); + EXPECT_EQ ( 1.1, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); +} -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , RealPowerLoadAt ) -// { // Total real power load for a snapshot (here 0 implicitly) for a vertexId -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "RealPowerLoadAt" -// , R"(Graph\(\).VertexExists\( vertexId \))"); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , LoadsAtVertex ) +{ // Return load properties at a vertex ID + std::vector multipleLoadProperties; + + network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 0 ) ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 0 ) ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + + network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 1 ) ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 1 ) ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + + network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 2 ) ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 2 ) ), multipleLoadProperties ); + EXPECT_EQ ( 0, multipleLoadProperties.size() ); + + network_.LoadsAt ( network_.Graph().VertexAt( static_cast( 3 ) ), multipleLoadProperties ); + EXPECT_EQ ( 1, multipleLoadProperties.size() ); + EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); + EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); + EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); + EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); + multipleLoadProperties.clear(); + + networkConst_.LoadsAt ( networkConst_.Graph().VertexAt( static_cast( 3 ) ), multipleLoadProperties ); + EXPECT_EQ ( 1, multipleLoadProperties.size() ); + + EXPECT_EQ ( "4", multipleLoadProperties[0].Name() ); + EXPECT_EQ ( Vertices::IeeeBusType::load, multipleLoadProperties[0].Type() ); + EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].RealPowerLoadBound().Minimum() ); + EXPECT_EQ ( 5.0, multipleLoadProperties[0].RealPowerLoadBound().Maximum() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoad() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Minimum() ); + EXPECT_EQ ( 0.0, multipleLoadProperties[0].ReactivePowerLoadBound().Maximum() ); +} + +// *********************************************************************** +// *********************************************************************** +#pragma mark RealPowerLoadAt +// *********************************************************************** +// *********************************************************************** -// ASSERT_DEATH ( {network_.RealPowerLoadAt ( static_cast( 0 ) );} -// , assertionString ); -// ASSERT_DEATH ( {networkConst_.RealPowerLoadAt ( static_cast( 0 ) );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , RealPowerLoadAtExceptionHandling ) -// { // Total real power load for a snapshot (here 0 implicitly) for a vertexId -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "RealPowerLoadAt" -// , R"(Graph\(\).VertexExists\( vertexId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , RealPowerLoadAt ) +{ // Total real power load for a snapshot (here 0 implicitly) for a vertexId + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "RealPowerLoadAt" + , R"(Graph\(\).VertexExists\( vertexId \))"); -// try { -// network_.RealPowerLoadAt ( static_cast( 0 ) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// try { -// networkConst_.RealPowerLoadAt ( static_cast( 0 ) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + ASSERT_DEATH ( {network_.RealPowerLoadAt ( static_cast( 0 ) );} + , assertionString ); + ASSERT_DEATH ( {networkConst_.RealPowerLoadAt ( static_cast( 0 ) );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , RealPowerLoadAtExceptionHandling ) +{ // Total real power load for a snapshot (here 0 implicitly) for a vertexId + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "RealPowerLoadAt" + , R"(Graph\(\).VertexExists\( vertexId \))"); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , RealPowerLoadAt ) -// { // Total real power load for a snapshot (here 0) for a vertexId -// Types::index snapshotId = 0; - -// Types::real result = network_.RealPowerLoadAt( static_cast( 3 ), snapshotId ); -// EXPECT_EQ ( 8.0 , result ); -// result = networkConst_.RealPowerLoadAt( static_cast( 3 ), snapshotId ); -// EXPECT_EQ ( 8.0 , result ); -// result = network_.RealPowerLoadAt( static_cast( 0 ), snapshotId ); -// EXPECT_EQ ( 0 , result ); -// result = networkConst_.RealPowerLoadAt( static_cast( 0 ), snapshotId ); -// EXPECT_EQ ( 0 , result ); -// } + try { + network_.RealPowerLoadAt ( static_cast( 0 ) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } + try { + networkConst_.RealPowerLoadAt ( static_cast( 0 ) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , RealPowerLoadAt ) -// { // Total real power load for a snapshot (here 0) for a vertexId -// Types::index snapshotId = 0; - -// Types::real result = network_.RealPowerLoadAt( static_cast( 3 ), snapshotId ); -// EXPECT_EQ ( 5.0 , result ); -// result = networkConst_.RealPowerLoadAt( static_cast( 3 ), snapshotId ); -// EXPECT_EQ ( 5.0 , result ); -// result = network_.RealPowerLoadAt( static_cast( 0 ), snapshotId ); -// EXPECT_EQ ( 0 , result ); -// result = networkConst_.RealPowerLoadAt( static_cast( 0 ), snapshotId ); -// EXPECT_EQ ( 0 , result ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , RealPowerLoadAt ) +{ // Total real power load for a snapshot (here 0) for a vertexId + Types::index snapshotId = 0; + + Types::real result = network_.RealPowerLoadAt( static_cast( 3 ), snapshotId ); + EXPECT_EQ ( 8.0 , result ); + result = networkConst_.RealPowerLoadAt( static_cast( 3 ), snapshotId ); + EXPECT_EQ ( 8.0 , result ); + result = network_.RealPowerLoadAt( static_cast( 0 ), snapshotId ); + EXPECT_EQ ( 0 , result ); + result = networkConst_.RealPowerLoadAt( static_cast( 0 ), snapshotId ); + EXPECT_EQ ( 0 , result ); +} -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark RealPowerLoadAtVertexObject -// // *********************************************************************** -// // *********************************************************************** +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , RealPowerLoadAt ) +{ // Total real power load for a snapshot (here 0) for a vertexId + Types::index snapshotId = 0; + + Types::real result = network_.RealPowerLoadAt( static_cast( 3 ), snapshotId ); + EXPECT_EQ ( 5.0 , result ); + result = networkConst_.RealPowerLoadAt( static_cast( 3 ), snapshotId ); + EXPECT_EQ ( 5.0 , result ); + result = network_.RealPowerLoadAt( static_cast( 0 ), snapshotId ); + EXPECT_EQ ( 0 , result ); + result = networkConst_.RealPowerLoadAt( static_cast( 0 ), snapshotId ); + EXPECT_EQ ( 0 , result ); +} -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , RealPowerLoadAtVertexObject ) -// { // Total real power load for a snapshot (here 0 implicitly) for a vertexId -// auto assertionString = buildAssertionString ( "StaticGraph.hpp" -// , "StaticGraph" -// , "VertexAt" -// , R"(VertexExists\(id\))"); - -// ASSERT_DEATH ( {network_.RealPowerLoadAt ( network_.Graph().VertexAt( static_cast( 0 ) ) );} -// , assertionString ); -// ASSERT_DEATH ( {networkConst_.RealPowerLoadAt ( networkConst_.Graph().VertexAt( static_cast( 0 ) ) );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , RealPowerLoadAtVertexObjectExceptionHandling ) -// { // Total real power load for a snapshot (here 0 implicitly) for a vertexId -// auto assertionString = buildAssertionString ( "StaticGraph.hpp" -// , "StaticGraph" -// , "VertexAt" -// , R"(VertexExists\(id\))"); +// *********************************************************************** +// *********************************************************************** +#pragma mark RealPowerLoadAtVertexObject +// *********************************************************************** +// *********************************************************************** -// try { -// network_.RealPowerLoadAt ( network_.Graph().VertexAt( static_cast( 0 ) ) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// try { -// networkConst_.RealPowerLoadAt ( networkConst_.Graph().VertexAt( static_cast( 0 ) ) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , RealPowerLoadAtVertexObject ) +{ // Total real power load for a snapshot (here 0 implicitly) for a vertexId + auto assertionString = buildAssertionString ( "StaticGraph.hpp" + , "StaticGraph" + , "VertexAt" + , R"(VertexExists\(id\))"); + + ASSERT_DEATH ( {network_.RealPowerLoadAt ( network_.Graph().VertexAt( static_cast( 0 ) ) );} + , assertionString ); + ASSERT_DEATH ( {networkConst_.RealPowerLoadAt ( networkConst_.Graph().VertexAt( static_cast( 0 ) ) );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , RealPowerLoadAtVertexObjectExceptionHandling ) +{ // Total real power load for a snapshot (here 0 implicitly) for a vertexId + auto assertionString = buildAssertionString ( "StaticGraph.hpp" + , "StaticGraph" + , "VertexAt" + , R"(VertexExists\(id\))"); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , RealPowerLoadAtVertexObject ) -// { // Total real power load for a snapshot (here 0) for a vertexId -// Types::index snapshotId = 0; - -// Types::real result = network_.RealPowerLoadAt( network_.Graph().VertexAt( static_cast( 3 ) ), snapshotId ); -// EXPECT_EQ ( 8.0 , result ); -// result = networkConst_.RealPowerLoadAt( networkConst_.Graph().VertexAt( static_cast( 3 ) ), snapshotId ); -// EXPECT_EQ ( 8.0 , result ); -// result = network_.RealPowerLoadAt( network_.Graph().VertexAt( static_cast( 0 ) ), snapshotId ); -// EXPECT_EQ ( 0 , result ); -// result = networkConst_.RealPowerLoadAt( networkConst_.Graph().VertexAt( static_cast( 0 ) ), snapshotId ); -// EXPECT_EQ ( 0 , result ); -// } + try { + network_.RealPowerLoadAt ( network_.Graph().VertexAt( static_cast( 0 ) ) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } + try { + networkConst_.RealPowerLoadAt ( networkConst_.Graph().VertexAt( static_cast( 0 ) ) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , RealPowerLoadAtVertexObject ) -// { // Total real power load for a snapshot (here 0) for a vertexId -// Types::index snapshotId = 0; - -// Types::real result = network_.RealPowerLoadAt( network_.Graph().VertexAt( static_cast( 3 ) ), snapshotId ); -// EXPECT_EQ ( 5.0 , result ); -// result = networkConst_.RealPowerLoadAt( networkConst_.Graph().VertexAt( static_cast( 3 ) ), snapshotId ); -// EXPECT_EQ ( 5.0 , result ); -// result = network_.RealPowerLoadAt( network_.Graph().VertexAt( static_cast( 0 ) ), snapshotId ); -// EXPECT_EQ ( 0 , result ); -// result = networkConst_.RealPowerLoadAt( networkConst_.Graph().VertexAt( static_cast( 0 ) ), snapshotId ); -// EXPECT_EQ ( 0 , result ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , RealPowerLoadAtVertexObject ) +{ // Total real power load for a snapshot (here 0) for a vertexId + Types::index snapshotId = 0; + + Types::real result = network_.RealPowerLoadAt( network_.Graph().VertexAt( static_cast( 3 ) ), snapshotId ); + EXPECT_EQ ( 8.0 , result ); + result = networkConst_.RealPowerLoadAt( networkConst_.Graph().VertexAt( static_cast( 3 ) ), snapshotId ); + EXPECT_EQ ( 8.0 , result ); + result = network_.RealPowerLoadAt( network_.Graph().VertexAt( static_cast( 0 ) ), snapshotId ); + EXPECT_EQ ( 0 , result ); + result = networkConst_.RealPowerLoadAt( networkConst_.Graph().VertexAt( static_cast( 0 ) ), snapshotId ); + EXPECT_EQ ( 0 , result ); +} -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark TotalRealPowerLoadBoundAt -// // *********************************************************************** -// // *********************************************************************** +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , RealPowerLoadAtVertexObject ) +{ // Total real power load for a snapshot (here 0) for a vertexId + Types::index snapshotId = 0; + + Types::real result = network_.RealPowerLoadAt( network_.Graph().VertexAt( static_cast( 3 ) ), snapshotId ); + EXPECT_EQ ( 5.0 , result ); + result = networkConst_.RealPowerLoadAt( networkConst_.Graph().VertexAt( static_cast( 3 ) ), snapshotId ); + EXPECT_EQ ( 5.0 , result ); + result = network_.RealPowerLoadAt( network_.Graph().VertexAt( static_cast( 0 ) ), snapshotId ); + EXPECT_EQ ( 0 , result ); + result = networkConst_.RealPowerLoadAt( networkConst_.Graph().VertexAt( static_cast( 0 ) ), snapshotId ); + EXPECT_EQ ( 0 , result ); +} -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , TotalRealPowerLoadBoundAt ) -// { // Total real power load for a snapshot (here 0 implicitly) for a vertexId -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalRealPowerLoadBoundAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); +// *********************************************************************** +// *********************************************************************** +#pragma mark TotalRealPowerLoadBoundAt +// *********************************************************************** +// *********************************************************************** -// ASSERT_DEATH ( {network_.TotalRealPowerLoadBoundAt ( static_cast( 0 ) );} -// , assertionString ); -// ASSERT_DEATH ( {networkConst_.TotalRealPowerLoadBoundAt ( static_cast( 0 ) );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , TotalRealPowerLoadBoundAtExceptionHandling ) -// { // Total real power load for a snapshot (here 0 implicitly) for a vertexId -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TotalRealPowerLoadBoundAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , TotalRealPowerLoadBoundAt ) +{ // Total real power load for a snapshot (here 0 implicitly) for a vertexId + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalRealPowerLoadBoundAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// try { -// network_.TotalRealPowerLoadBoundAt ( static_cast( 0 ) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// try { -// networkConst_.TotalRealPowerLoadBoundAt ( static_cast( 0 ) ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + ASSERT_DEATH ( {network_.TotalRealPowerLoadBoundAt ( static_cast( 0 ) );} + , assertionString ); + ASSERT_DEATH ( {networkConst_.TotalRealPowerLoadBoundAt ( static_cast( 0 ) );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , TotalRealPowerLoadBoundAtExceptionHandling ) +{ // Total real power load for a snapshot (here 0 implicitly) for a vertexId + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TotalRealPowerLoadBoundAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TotalRealPowerLoadBoundAt ) -// { // Total real power load for a snapshot (here 0) for a vertexId -// network_.MakePureUnbounded (); -// TBound bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 0.0 , bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); -// bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 0.0 , bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); + try { + network_.TotalRealPowerLoadBoundAt ( static_cast( 0 ) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } + try { + networkConst_.TotalRealPowerLoadBoundAt ( static_cast( 0 ) ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// network_.MakeExact (); -// bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 8.0 , bound.Minimum() ); -// EXPECT_EQ ( 8.0 , bound.Maximum() ); -// bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 8.0 , bound.Minimum() ); -// EXPECT_EQ ( 8.0 , bound.Maximum() ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TotalRealPowerLoadBoundAt ) +{ // Total real power load for a snapshot (here 0) for a vertexId + network_.MakePureUnbounded (); + TBound bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 0.0 , bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); + bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 0.0 , bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); -// network_.MakeBounded (); -// bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 0.0 , bound.Minimum() ); -// EXPECT_EQ ( 8.0 , bound.Maximum() ); -// bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 0.0 , bound.Minimum() ); -// EXPECT_EQ ( 8.0 , bound.Maximum() ); + network_.MakeExact (); + bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 8.0 , bound.Minimum() ); + EXPECT_EQ ( 8.0 , bound.Maximum() ); + bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 8.0 , bound.Minimum() ); + EXPECT_EQ ( 8.0 , bound.Maximum() ); -// network_.MakeUnbounded (); -// bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 0.0 , bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); -// bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 0.0 , bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); -// } + network_.MakeBounded (); + bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 0.0 , bound.Minimum() ); + EXPECT_EQ ( 8.0 , bound.Maximum() ); + bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 0.0 , bound.Minimum() ); + EXPECT_EQ ( 8.0 , bound.Maximum() ); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , TotalRealPowerLoadBoundAt ) -// { // Total real power load for a snapshot (here 0) for a vertexId -// network_.MakePureUnbounded (); -// TBound bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 0.0 , bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); -// bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 0.0 , bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); + network_.MakeUnbounded (); + bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 0.0 , bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); + bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 0.0 , bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); +} -// network_.MakeExact (); -// bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 5.0 , bound.Minimum() ); -// EXPECT_EQ ( 5.0 , bound.Maximum() ); -// bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 5.0 , bound.Minimum() ); -// EXPECT_EQ ( 5.0 , bound.Maximum() ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , TotalRealPowerLoadBoundAt ) +{ // Total real power load for a snapshot (here 0) for a vertexId + network_.MakePureUnbounded (); + TBound bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 0.0 , bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); + bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 0.0 , bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); -// network_.MakeBounded (); -// bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 0.0 , bound.Minimum() ); -// EXPECT_EQ ( 5.0 , bound.Maximum() ); -// bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 0.0 , bound.Minimum() ); -// EXPECT_EQ ( 5.0 , bound.Maximum() ); + network_.MakeExact (); + bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 5.0 , bound.Minimum() ); + EXPECT_EQ ( 5.0 , bound.Maximum() ); + bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 5.0 , bound.Minimum() ); + EXPECT_EQ ( 5.0 , bound.Maximum() ); -// network_.MakeUnbounded (); -// bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 0.0 , bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); -// bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); -// EXPECT_EQ ( 0.0 , bound.Minimum() ); -// EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); -// } + network_.MakeBounded (); + bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 0.0 , bound.Minimum() ); + EXPECT_EQ ( 5.0 , bound.Maximum() ); + bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 0.0 , bound.Minimum() ); + EXPECT_EQ ( 5.0 , bound.Maximum() ); -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark AddGeneratorRealPowerSnapshotAt -// // *********************************************************************** -// // *********************************************************************** + network_.MakeUnbounded (); + bound = network_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 0.0 , bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); + bound = networkConst_.TotalRealPowerLoadBoundAt( static_cast( 3 ) ); + EXPECT_EQ ( 0.0 , bound.Minimum() ); + EXPECT_EQ ( Const::REAL_INFTY , bound.Maximum() ); +} -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , AddGeneratorRealPowerSnapshotAt ) -// { // Add generator snapshot (real power) -// TGeneratorProperties generatorProperties; +// *********************************************************************** +// *********************************************************************** +#pragma mark AddGeneratorRealPowerSnapshotAt +// *********************************************************************** +// *********************************************************************** -// CreateExampleGeneratorProperties( generatorProperties ); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , AddGeneratorRealPowerSnapshotAt ) +{ // Add generator snapshot (real power) + TGeneratorProperties generatorProperties; -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddGeneratorAt" -// , R"(Graph\(\).VertexExists\( vertexId \))"); + CreateExampleGeneratorProperties( generatorProperties ); -// ASSERT_DEATH ( {network_.AddGeneratorAt(static_cast(0), generatorProperties);} -// , assertionString ); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddGeneratorAt" + , R"(Graph\(\).VertexExists\( vertexId \))"); -// Types::generatorId generatorId = static_cast(0); -// assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddGeneratorRealPowerSnapshotAt" -// , R"(HasGenerator \( generatorId \))"); -// ASSERT_DEATH ( {network_.AddGeneratorRealPowerSnapshotAt( generatorId, generatorProperties.RealPower() );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , AddGeneratorRealPowerSnapshotAtExceptionHandling ) -// { // Add generator snapshot (real power) -// TGeneratorProperties generatorProperties; + ASSERT_DEATH ( {network_.AddGeneratorAt(static_cast(0), generatorProperties);} + , assertionString ); -// CreateExampleGeneratorProperties( generatorProperties ); + Types::generatorId generatorId = static_cast(0); + assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddGeneratorRealPowerSnapshotAt" + , R"(HasGenerator \( generatorId \))"); + ASSERT_DEATH ( {network_.AddGeneratorRealPowerSnapshotAt( generatorId, generatorProperties.RealPower() );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , AddGeneratorRealPowerSnapshotAtExceptionHandling ) +{ // Add generator snapshot (real power) + TGeneratorProperties generatorProperties; -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddGeneratorAt" -// , R"(Graph\(\).VertexExists\( vertexId \))"); + CreateExampleGeneratorProperties( generatorProperties ); -// try { -// network_.AddGeneratorAt(static_cast(0), generatorProperties); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddGeneratorAt" + , R"(Graph\(\).VertexExists\( vertexId \))"); -// Types::generatorId generatorId = static_cast(0); -// assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddGeneratorRealPowerSnapshotAt" -// , R"(HasGenerator \( generatorId \))"); -// try { -// network_.AddGeneratorRealPowerSnapshotAt( generatorId, generatorProperties.RealPower() ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.AddGeneratorAt(static_cast(0), generatorProperties); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , AddGeneratorRealPowerSnapshotAt ) -// { // Add generator snapshot (real power) -// TGeneratorProperties generatorProperties; + Types::generatorId generatorId = static_cast(0); + assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddGeneratorRealPowerSnapshotAt" + , R"(HasGenerator \( generatorId \))"); + try { + network_.AddGeneratorRealPowerSnapshotAt( generatorId, generatorProperties.RealPower() ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// CreateExampleGeneratorProperties( generatorProperties ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(2) ) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , AddGeneratorRealPowerSnapshotAt ) +{ // Add generator snapshot (real power) + TGeneratorProperties generatorProperties; -// Types::generatorId generatorId = network_.AddGeneratorAt(static_cast(2), generatorProperties); + CreateExampleGeneratorProperties( generatorProperties ); + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(2) ) ); -// network_.AddGeneratorRealPowerSnapshotAt( generatorId, generatorProperties.RealPower() ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(2) ) ); + Types::generatorId generatorId = network_.AddGeneratorAt(static_cast(2), generatorProperties); -// std::vector generatorsAtVertex; -// network_.GeneratorsAt ( static_cast(2), generatorsAtVertex ); -// if ( !generatorsAtVertex.empty() ) -// { -// generatorProperties = generatorsAtVertex[0]; -// } -// EXPECT_EQ ( 1, generatorsAtVertex.size() ); + network_.AddGeneratorRealPowerSnapshotAt( generatorId, generatorProperties.RealPower() ); + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(2) ) ); -// CheckExampleGeneratorProperties ( generatorProperties ); -// generatorsAtVertex.clear(); + std::vector generatorsAtVertex; + network_.GeneratorsAt ( static_cast(2), generatorsAtVertex ); + if ( !generatorsAtVertex.empty() ) + { + generatorProperties = generatorsAtVertex[0]; + } + EXPECT_EQ ( 1, generatorsAtVertex.size() ); -// network_.GeneratorsAt ( static_cast(2), generatorsAtVertex ); -// if ( !generatorsAtVertex.empty() ) -// { -// generatorProperties = generatorsAtVertex[0]; -// } -// EXPECT_EQ ( 1, generatorsAtVertex.size() ); -// CheckExampleGeneratorProperties ( generatorProperties ); -// } + CheckExampleGeneratorProperties ( generatorProperties ); + generatorsAtVertex.clear(); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , AddGeneratorRealPowerSnapshotAt ) -// { // Add generator snapshot (real power) -// TGeneratorProperties generatorProperties; + network_.GeneratorsAt ( static_cast(2), generatorsAtVertex ); + if ( !generatorsAtVertex.empty() ) + { + generatorProperties = generatorsAtVertex[0]; + } + EXPECT_EQ ( 1, generatorsAtVertex.size() ); + CheckExampleGeneratorProperties ( generatorProperties ); +} -// CreateExampleGeneratorProperties( generatorProperties ); -// EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , AddGeneratorRealPowerSnapshotAt ) +{ // Add generator snapshot (real power) + TGeneratorProperties generatorProperties; -// Types::generatorId generatorId = network_.AddGeneratorAt(static_cast(1), generatorProperties); + CreateExampleGeneratorProperties( generatorProperties ); + EXPECT_FALSE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// network_.AddGeneratorRealPowerSnapshotAt( generatorId, generatorProperties.RealPower() ); -// network_.AddGeneratorRealPowerSnapshotAt( generatorId, generatorProperties.RealPower() ); -// EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(1) ) ); + Types::generatorId generatorId = network_.AddGeneratorAt(static_cast(1), generatorProperties); -// std::vector generatorsAtVertex; -// network_.GeneratorsAt ( static_cast(1), generatorsAtVertex ); -// if ( !generatorsAtVertex.empty() ) -// { -// generatorProperties = generatorsAtVertex[0]; -// } -// EXPECT_EQ ( 1, generatorsAtVertex.size() ); + network_.AddGeneratorRealPowerSnapshotAt( generatorId, generatorProperties.RealPower() ); + network_.AddGeneratorRealPowerSnapshotAt( generatorId, generatorProperties.RealPower() ); + EXPECT_TRUE ( network_.HasGeneratorAt ( static_cast(1) ) ); -// CheckExampleGeneratorProperties ( generatorProperties ); -// generatorsAtVertex.clear(); + std::vector generatorsAtVertex; + network_.GeneratorsAt ( static_cast(1), generatorsAtVertex ); + if ( !generatorsAtVertex.empty() ) + { + generatorProperties = generatorsAtVertex[0]; + } + EXPECT_EQ ( 1, generatorsAtVertex.size() ); -// network_.GeneratorsAt ( static_cast(1), generatorsAtVertex ); -// if ( !generatorsAtVertex.empty() ) -// { -// generatorProperties = generatorsAtVertex[0]; -// } -// EXPECT_EQ ( 1, generatorsAtVertex.size() ); -// CheckExampleGeneratorProperties ( generatorProperties ); + CheckExampleGeneratorProperties ( generatorProperties ); + generatorsAtVertex.clear(); -// EXPECT_EQ ( 9.9, network_.GeneratorRealPowerSnapshotAt(generatorId, 0) ); -// EXPECT_EQ ( 9.9, network_.GeneratorRealPowerSnapshotAt(generatorId, 1) ); -// } + network_.GeneratorsAt ( static_cast(1), generatorsAtVertex ); + if ( !generatorsAtVertex.empty() ) + { + generatorProperties = generatorsAtVertex[0]; + } + EXPECT_EQ ( 1, generatorsAtVertex.size() ); + CheckExampleGeneratorProperties ( generatorProperties ); -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark UpdateGeneratorSnapshotSize -// // *********************************************************************** -// // *********************************************************************** + EXPECT_EQ ( 9.9, network_.GeneratorRealPowerSnapshotAt(generatorId, 0) ); + EXPECT_EQ ( 9.9, network_.GeneratorRealPowerSnapshotAt(generatorId, 1) ); +} -// TEST_F ( TestNetworkEmpty -// , UpdateGeneratorSnapshotSize ) -// { -// network_.UpdateGeneratorSnapshotSize(); -// } +// *********************************************************************** +// *********************************************************************** +#pragma mark UpdateGeneratorSnapshotSize +// *********************************************************************** +// *********************************************************************** -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , UpdateGeneratorSnapshotSize ) -// { -// network_.UpdateGeneratorSnapshotSize(); -// } +TEST_F ( TestNetworkEmpty + , UpdateGeneratorSnapshotSize ) +{ + network_.UpdateGeneratorSnapshotSize(); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , UpdateGeneratorSnapshotSize ) -// { -// network_.UpdateGeneratorSnapshotSize(); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , UpdateGeneratorSnapshotSize ) +{ + network_.UpdateGeneratorSnapshotSize(); +} -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark UpdateLoadSnapshotSize -// // *********************************************************************** -// // *********************************************************************** +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , UpdateGeneratorSnapshotSize ) +{ + network_.UpdateGeneratorSnapshotSize(); +} -// TEST_F ( TestNetworkEmpty -// , UpdateLoadSnapshotSize ) -// { -// network_.UpdateLoadSnapshotSize(); -// } +// *********************************************************************** +// *********************************************************************** +#pragma mark UpdateLoadSnapshotSize +// *********************************************************************** +// *********************************************************************** -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , UpdateLoadSnapshotSize ) -// { -// network_.UpdateLoadSnapshotSize(); -// } +TEST_F ( TestNetworkEmpty + , UpdateLoadSnapshotSize ) +{ + network_.UpdateLoadSnapshotSize(); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , UpdateLoadSnapshotSize ) -// { -// network_.UpdateLoadSnapshotSize(); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , UpdateLoadSnapshotSize ) +{ + network_.UpdateLoadSnapshotSize(); +} -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark AddLoadSnapshotAt -// // *********************************************************************** -// // *********************************************************************** +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , UpdateLoadSnapshotSize ) +{ + network_.UpdateLoadSnapshotSize(); +} -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , AddLoadSnapshotAt ) -// { -// TLoadProperties loadProperties; +// *********************************************************************** +// *********************************************************************** +#pragma mark AddLoadSnapshotAt +// *********************************************************************** +// *********************************************************************** -// CreateExampleLoadProperties( loadProperties ); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , AddLoadSnapshotAt ) +{ + TLoadProperties loadProperties; -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddLoadAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + CreateExampleLoadProperties( loadProperties ); -// ASSERT_DEATH ( {network_.AddLoadAt(static_cast(0), loadProperties);} -// , assertionString ); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddLoadAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// Types::loadId loadId = static_cast(0); -// assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddLoadSnapshotAt" -// , R"(HasLoad \( loadId \))"); -// ASSERT_DEATH ( {network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , AddLoadSnapshotAtExceptionHandling ) -// { -// TLoadProperties loadProperties; + ASSERT_DEATH ( {network_.AddLoadAt(static_cast(0), loadProperties);} + , assertionString ); -// CreateExampleLoadProperties( loadProperties ); + Types::loadId loadId = static_cast(0); + assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddLoadSnapshotAt" + , R"(HasLoad \( loadId \))"); + ASSERT_DEATH ( {network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , AddLoadSnapshotAtExceptionHandling ) +{ + TLoadProperties loadProperties; -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddLoadAt" -// , R"(Graph\(\).VertexExists \( vertexId \))"); + CreateExampleLoadProperties( loadProperties ); -// try { -// network_.AddLoadAt(static_cast(0), loadProperties); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddLoadAt" + , R"(Graph\(\).VertexExists \( vertexId \))"); -// Types::loadId loadId = static_cast(0); -// assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddLoadSnapshotAt" -// , R"(HasLoad \( loadId \))"); -// try { -// network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.AddLoadAt(static_cast(0), loadProperties); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , AddLoadSnapshotAt ) -// { -// TLoadProperties loadProperties; + Types::loadId loadId = static_cast(0); + assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddLoadSnapshotAt" + , R"(HasLoad \( loadId \))"); + try { + network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// CreateExampleLoadProperties( loadProperties ); -// EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , AddLoadSnapshotAt ) +{ + TLoadProperties loadProperties; -// Types::loadId loadId = network_.AddLoadAt(static_cast(1), loadProperties); + CreateExampleLoadProperties( loadProperties ); + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); -// network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() ); -// EXPECT_TRUE ( network_.HasLoadAt ( static_cast(1) ) ); + Types::loadId loadId = network_.AddLoadAt(static_cast(1), loadProperties); -// std::vector loadsAtVertex; -// network_.LoadsAt ( static_cast(1), loadsAtVertex ); -// if ( !loadsAtVertex.empty() ) -// { -// loadProperties = loadsAtVertex[0]; -// } -// EXPECT_EQ ( 1, loadsAtVertex.size() ); + network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() ); + EXPECT_TRUE ( network_.HasLoadAt ( static_cast(1) ) ); -// CheckExampleLoadProperties ( loadProperties ); -// loadsAtVertex.clear(); + std::vector loadsAtVertex; + network_.LoadsAt ( static_cast(1), loadsAtVertex ); + if ( !loadsAtVertex.empty() ) + { + loadProperties = loadsAtVertex[0]; + } + EXPECT_EQ ( 1, loadsAtVertex.size() ); -// network_.LoadsAt ( static_cast(1), loadsAtVertex ); -// if ( !loadsAtVertex.empty() ) -// { -// loadProperties = loadsAtVertex[0]; -// } -// EXPECT_EQ ( 1, loadsAtVertex.size() ); -// CheckExampleLoadProperties ( loadProperties ); -// } + CheckExampleLoadProperties ( loadProperties ); + loadsAtVertex.clear(); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , AddLoadSnapshotAt ) -// { -// TLoadProperties loadProperties; + network_.LoadsAt ( static_cast(1), loadsAtVertex ); + if ( !loadsAtVertex.empty() ) + { + loadProperties = loadsAtVertex[0]; + } + EXPECT_EQ ( 1, loadsAtVertex.size() ); + CheckExampleLoadProperties ( loadProperties ); +} -// CreateExampleLoadProperties( loadProperties ); -// EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , AddLoadSnapshotAt ) +{ + TLoadProperties loadProperties; -// Types::loadId loadId = network_.AddLoadAt(static_cast(1), loadProperties); + CreateExampleLoadProperties( loadProperties ); + EXPECT_FALSE ( network_.HasLoadAt ( static_cast(1) ) ); -// network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() ); -// network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() ); -// network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() ); -// EXPECT_TRUE ( network_.HasLoadAt ( static_cast(1) ) ); + Types::loadId loadId = network_.AddLoadAt(static_cast(1), loadProperties); -// std::vector loadsAtVertex; -// network_.LoadsAt ( static_cast(1), loadsAtVertex ); -// if ( !loadsAtVertex.empty() ) -// { -// loadProperties = loadsAtVertex[0]; -// } -// EXPECT_EQ ( 1, loadsAtVertex.size() ); + network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() ); + network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() ); + network_.AddLoadSnapshotAt( loadId, loadProperties.RealPowerLoad() ); + EXPECT_TRUE ( network_.HasLoadAt ( static_cast(1) ) ); -// CheckExampleLoadProperties ( loadProperties ); -// loadsAtVertex.clear(); + std::vector loadsAtVertex; + network_.LoadsAt ( static_cast(1), loadsAtVertex ); + if ( !loadsAtVertex.empty() ) + { + loadProperties = loadsAtVertex[0]; + } + EXPECT_EQ ( 1, loadsAtVertex.size() ); -// network_.LoadsAt ( static_cast(1), loadsAtVertex ); -// if ( !loadsAtVertex.empty() ) -// { -// loadProperties = loadsAtVertex[0]; -// } -// EXPECT_EQ ( 1, loadsAtVertex.size() ); -// CheckExampleLoadProperties ( loadProperties ); -// } + CheckExampleLoadProperties ( loadProperties ); + loadsAtVertex.clear(); -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark AddSnapshotWeighting -// // *********************************************************************** -// // *********************************************************************** + network_.LoadsAt ( static_cast(1), loadsAtVertex ); + if ( !loadsAtVertex.empty() ) + { + loadProperties = loadsAtVertex[0]; + } + EXPECT_EQ ( 1, loadsAtVertex.size() ); + CheckExampleLoadProperties ( loadProperties ); +} -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmpty -// , AddSnapshotWeighting ) -// { -// network_.AddSnapshotWeighting( 9.9 ); +// *********************************************************************** +// *********************************************************************** +#pragma mark AddSnapshotWeighting +// *********************************************************************** +// *********************************************************************** -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddSnapshotWeighting" -// , "weight != Const::NONE"); -// ASSERT_DEATH ( {network_.AddSnapshotWeighting( Const::NONE );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , AddSnapshotWeightingExceptionHandling ) -// { -// network_.AddSnapshotWeighting( 9.9 ); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmpty + , AddSnapshotWeighting ) +{ + network_.AddSnapshotWeighting( 9.9 ); -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddSnapshotWeighting" -// , "weight != Const::NONE"); -// try { -// network_.AddSnapshotWeighting( Const::NONE ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddSnapshotWeighting" + , "weight != Const::NONE"); + ASSERT_DEATH ( {network_.AddSnapshotWeighting( Const::NONE );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , AddSnapshotWeightingExceptionHandling ) +{ + network_.AddSnapshotWeighting( 9.9 ); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , AddSnapshotWeighting ) -// { -// network_.AddSnapshotWeighting( 9.9 ); -// network_.AddSnapshotWeighting( 1.9 ); -// } + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddSnapshotWeighting" + , "weight != Const::NONE"); + try { + network_.AddSnapshotWeighting( Const::NONE ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , AddSnapshotWeighting ) -// { -// network_.AddSnapshotWeighting( 4.9 ); -// network_.AddSnapshotWeighting( 3.9 ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , AddSnapshotWeighting ) +{ + network_.AddSnapshotWeighting( 9.9 ); + network_.AddSnapshotWeighting( 1.9 ); +} -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark AddSnapshotTimestamp -// // *********************************************************************** -// // *********************************************************************** +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , AddSnapshotWeighting ) +{ + network_.AddSnapshotWeighting( 4.9 ); + network_.AddSnapshotWeighting( 3.9 ); +} -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , AddSnapshotTimestamp ) -// { -// network_.AddSnapshotTimestamp( "2019-09-19 19:19:19" ); +// *********************************************************************** +// *********************************************************************** +#pragma mark AddSnapshotTimestamp +// *********************************************************************** +// *********************************************************************** -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddSnapshotTimestamp" -// , "!timestamp.empty\\(\\)"); -// ASSERT_DEATH ( {network_.AddSnapshotTimestamp( "" );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , AddSnapshotTimestampExceptionHandling ) -// { -// network_.AddSnapshotTimestamp( "2019-09-19 19:19:19" ); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , AddSnapshotTimestamp ) +{ + network_.AddSnapshotTimestamp( "2019-09-19 19:19:19" ); -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "AddSnapshotTimestamp" -// , "!timestamp.empty\\(\\)"); -// try { -// network_.AddSnapshotTimestamp( "" ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddSnapshotTimestamp" + , "!timestamp.empty\\(\\)"); + ASSERT_DEATH ( {network_.AddSnapshotTimestamp( "" );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , AddSnapshotTimestampExceptionHandling ) +{ + network_.AddSnapshotTimestamp( "2019-09-19 19:19:19" ); -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , AddSnapshotTimestamp ) -// { -// network_.AddSnapshotTimestamp( "2009-09-19 19:19:19" ); -// network_.AddSnapshotTimestamp( "2019-09-19 19:19:19" ); -// } + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "AddSnapshotTimestamp" + , "!timestamp.empty\\(\\)"); + try { + network_.AddSnapshotTimestamp( "" ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , AddSnapshotTimestamp ) -// { -// network_.AddSnapshotTimestamp( "2009-09-19 19:19:19" ); -// network_.AddSnapshotTimestamp( "2019-09-19 19:19:19" ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , AddSnapshotTimestamp ) +{ + network_.AddSnapshotTimestamp( "2009-09-19 19:19:19" ); + network_.AddSnapshotTimestamp( "2019-09-19 19:19:19" ); +} -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark PositionOf -// // *********************************************************************** -// // *********************************************************************** +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , AddSnapshotTimestamp ) +{ + network_.AddSnapshotTimestamp( "2009-09-19 19:19:19" ); + network_.AddSnapshotTimestamp( "2019-09-19 19:19:19" ); +} -// TEST_F ( TestNetworkEmpty -// , PositionOf ) -// { -// Types::index index = network_.PositionOf ( "2009-09-19 19:19:19" ); -// EXPECT_EQ ( Const::NONE, index ); -// } +// *********************************************************************** +// *********************************************************************** +#pragma mark PositionOf +// *********************************************************************** +// *********************************************************************** -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , PositionOf ) -// { -// Types::index index = network_.PositionOf ( "2009-09-19 19:19:19" ); -// EXPECT_EQ ( Const::NONE, index ); -// } +TEST_F ( TestNetworkEmpty + , PositionOf ) +{ + Types::index index = network_.PositionOf ( "2009-09-19 19:19:19" ); + EXPECT_EQ ( Const::NONE, index ); +} -// TEST_F ( TestPowerGridAcm2018MtsfFigure4b -// , PositionOf ) -// { -// Types::index index = network_.PositionOf ( "2009-09-19 19:19:19" ); -// EXPECT_EQ ( Const::NONE, index ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , PositionOf ) +{ + Types::index index = network_.PositionOf ( "2009-09-19 19:19:19" ); + EXPECT_EQ ( Const::NONE, index ); +} + +TEST_F ( TestPowerGridAcm2018MtsfFigure4b + , PositionOf ) +{ + Types::index index = network_.PositionOf ( "2009-09-19 19:19:19" ); + EXPECT_EQ ( Const::NONE, index ); +} // TEST_F ( TestPowerGridPyPsaExample // , PositionOf ) @@ -5203,52 +5203,52 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // EXPECT_EQ ( 3, index ); // } -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark TimestampAt -// // *********************************************************************** -// // *********************************************************************** +// *********************************************************************** +// *********************************************************************** +#pragma mark TimestampAt +// *********************************************************************** +// *********************************************************************** -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmpty -// , TimestampAt ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TimestampAt" -// , R"(timestampPosition < timestamps_.size\(\))"); -// ASSERT_DEATH ( {network_.TimestampAt ( 0 );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , TimestampAtExceptionHandling ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "TimestampAt" -// , R"(timestampPosition < timestamps_.size\(\))"); -// try { -// network_.TimestampAt ( 0 ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmpty + , TimestampAt ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TimestampAt" + , R"(timestampPosition < timestamps_.size\(\))"); + ASSERT_DEATH ( {network_.TimestampAt ( 0 );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , TimestampAtExceptionHandling ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "TimestampAt" + , R"(timestampPosition < timestamps_.size\(\))"); + try { + network_.TimestampAt ( 0 ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , TimestampAt ) -// { -// Types::timestampSnapshot timestamp = network_.TimestampAt ( 0 ); -// EXPECT_EQ ( "0000-00-00 00:00:00", timestamp ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , TimestampAt ) +{ + Types::timestampSnapshot timestamp = network_.TimestampAt ( 0 ); + EXPECT_EQ ( "0000-00-00 00:00:00", timestamp ); +} // TEST_F ( TestPowerGridPyPsaExample // , TimestampAt ) @@ -5257,47 +5257,47 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // EXPECT_EQ ( "2013-01-01 07:00:00", timestamp ); // } -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark GeneratorRealPowerSnapshotAtUsingGeneratorIdAndTimestamp -// // *********************************************************************** -// // *********************************************************************** +// *********************************************************************** +// *********************************************************************** +#pragma mark GeneratorRealPowerSnapshotAtUsingGeneratorIdAndTimestamp +// *********************************************************************** +// *********************************************************************** -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmpty -// , GeneratorRealPowerSnapshotAtUsingGeneratorIdAndTimestamp ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "GeneratorRealPowerSnapshotAt" -// , R"(generatorId < NumberOfGenerators\(\))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmpty + , GeneratorRealPowerSnapshotAtUsingGeneratorIdAndTimestamp ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "GeneratorRealPowerSnapshotAt" + , R"(generatorId < NumberOfGenerators\(\))"); -// ASSERT_DEATH ( {network_.GeneratorRealPowerSnapshotAt ( 0, "0000-00-00 00:00:00" );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , GeneratorRealPowerSnapshotAtUsingGeneratorIdAndTimestampExceptionHandling ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "GeneratorRealPowerSnapshotAt" -// , R"(generatorId < NumberOfGenerators\(\))"); + ASSERT_DEATH ( {network_.GeneratorRealPowerSnapshotAt ( 0, "0000-00-00 00:00:00" );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , GeneratorRealPowerSnapshotAtUsingGeneratorIdAndTimestampExceptionHandling ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "GeneratorRealPowerSnapshotAt" + , R"(generatorId < NumberOfGenerators\(\))"); -// try { -// network_.GeneratorRealPowerSnapshotAt ( 0, "0000-00-00 00:00:00" ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.GeneratorRealPowerSnapshotAt ( 0, "0000-00-00 00:00:00" ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION // TEST_F ( TestPowerGridPyPsaExample // , GeneratorRealPowerSnapshotAtUsingGeneratorIdAndTimestamp ) @@ -5306,20 +5306,20 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // EXPECT_EQ ( 230, snapshot ); // } -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark GeneratorRealPowerSnapshotAtUsingGeneratorAndTimestamp -// // *********************************************************************** -// // *********************************************************************** +// *********************************************************************** +// *********************************************************************** +#pragma mark GeneratorRealPowerSnapshotAtUsingGeneratorAndTimestamp +// *********************************************************************** +// *********************************************************************** -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , GeneratorRealPowerSnapshotAtUsingGeneratorAndTimestamp ) -// { -// TGeneratorProperties generator = network_.GeneratorAt ( 0 ); +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , GeneratorRealPowerSnapshotAtUsingGeneratorAndTimestamp ) +{ + TGeneratorProperties generator = network_.GeneratorAt ( 0 ); -// EXPECT_EQ ( Const::NONE -// , network_.GeneratorRealPowerSnapshotAt ( generator, "0000-00-00 01:00:00" ) ); -// } + EXPECT_EQ ( Const::NONE + , network_.GeneratorRealPowerSnapshotAt ( generator, "0000-00-00 01:00:00" ) ); +} // TEST_F ( TestPowerGridPyPsaExample // , GeneratorRealPowerSnapshotAtUsingGeneratorAndTimestamp ) @@ -5328,201 +5328,201 @@ TEST_F ( TestPowerGridAcm2018MtsfFigure4b // EXPECT_EQ ( 230, network_.GeneratorRealPowerSnapshotAt ( generator, "2013-01-01 03:00:00" ) ); // } -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark GeneratorRealPowerSnapshotsAt -// // *********************************************************************** -// // *********************************************************************** -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , GeneratorRealPowerSnapshotsAt ) -// { -// std::vector snapshotsAtTimestamp; +// *********************************************************************** +// *********************************************************************** +#pragma mark GeneratorRealPowerSnapshotsAt +// *********************************************************************** +// *********************************************************************** +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , GeneratorRealPowerSnapshotsAt ) +{ + std::vector snapshotsAtTimestamp; -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "GeneratorRealPowerSnapshotsAt" -// , R"(!timestamps_.empty\(\))"); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "GeneratorRealPowerSnapshotsAt" + , R"(!timestamps_.empty\(\))"); -// ASSERT_DEATH ( {network_.GeneratorRealPowerSnapshotsAt ( "0000-00-00 01:00:00" -// , snapshotsAtTimestamp );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , GeneratorRealPowerSnapshotsAtExceptionHandling ) -// { -// std::vector snapshotsAtTimestamp; + ASSERT_DEATH ( {network_.GeneratorRealPowerSnapshotsAt ( "0000-00-00 01:00:00" + , snapshotsAtTimestamp );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , GeneratorRealPowerSnapshotsAtExceptionHandling ) +{ + std::vector snapshotsAtTimestamp; -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "GeneratorRealPowerSnapshotsAt" -// , R"(!timestamps_.empty\(\))"); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "GeneratorRealPowerSnapshotsAt" + , R"(!timestamps_.empty\(\))"); -// try { -// network_.GeneratorRealPowerSnapshotsAt ( "0000-00-00 01:00:00" -// , snapshotsAtTimestamp ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.GeneratorRealPowerSnapshotsAt ( "0000-00-00 01:00:00" + , snapshotsAtTimestamp ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest -// , GeneratorRealPowerSnapshotsAt ) -// { -// std::vector snapshotsAtTimestamp; -// snapshotsAtTimestamp.emplace_back ( Const::NONE ); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestPowerGridAcm2018MtsfFigure4aDeathTest + , GeneratorRealPowerSnapshotsAt ) +{ + std::vector snapshotsAtTimestamp; + snapshotsAtTimestamp.emplace_back ( Const::NONE ); -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "GeneratorRealPowerSnapshotsAt" -// , R"(snapshotsAtTimestamp.empty\(\))"); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "GeneratorRealPowerSnapshotsAt" + , R"(snapshotsAtTimestamp.empty\(\))"); -// ASSERT_DEATH ( {network_.GeneratorRealPowerSnapshotsAt ( "0000-00-00 01:00:00" -// , snapshotsAtTimestamp );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , GeneratorRealPowerSnapshotsAtExceptionHandling ) -// { -// std::vector snapshotsAtTimestamp; -// snapshotsAtTimestamp.emplace_back ( Const::NONE ); + ASSERT_DEATH ( {network_.GeneratorRealPowerSnapshotsAt ( "0000-00-00 01:00:00" + , snapshotsAtTimestamp );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , GeneratorRealPowerSnapshotsAtExceptionHandling ) +{ + std::vector snapshotsAtTimestamp; + snapshotsAtTimestamp.emplace_back ( Const::NONE ); -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "GeneratorRealPowerSnapshotsAt" -// , R"(snapshotsAtTimestamp.empty\(\))"); + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "GeneratorRealPowerSnapshotsAt" + , R"(snapshotsAtTimestamp.empty\(\))"); -// try { -// network_.GeneratorRealPowerSnapshotsAt ( "0000-00-00 01:00:00" -// , snapshotsAtTimestamp ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.GeneratorRealPowerSnapshotsAt ( "0000-00-00 01:00:00" + , snapshotsAtTimestamp ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , GeneratorRealPowerSnapshotsAt ) -// { -// std::vector snapshotsAtTimestamp; +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , GeneratorRealPowerSnapshotsAt ) +{ + std::vector snapshotsAtTimestamp; -// network_.GeneratorRealPowerSnapshotsAt ( "0000-00-00 00:00:00" -// , snapshotsAtTimestamp ); + network_.GeneratorRealPowerSnapshotsAt ( "0000-00-00 00:00:00" + , snapshotsAtTimestamp ); -// for ( auto snapshot : snapshotsAtTimestamp ) -// { -// EXPECT_EQ ( 1.234, snapshot ); -// } -// } + for ( auto snapshot : snapshotsAtTimestamp ) + { + EXPECT_EQ ( 1.234, snapshot ); + } +} -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark ReactivePower -// // *********************************************************************** -// // *********************************************************************** -// // @todo Not tested yet +// *********************************************************************** +// *********************************************************************** +#pragma mark ReactivePower +// *********************************************************************** +// *********************************************************************** +// @todo Not tested yet -// // *********************************************************************** -// // *********************************************************************** -// #pragma mark LoadSnapshotLogic -// // *********************************************************************** -// // *********************************************************************** +// *********************************************************************** +// *********************************************************************** +#pragma mark LoadSnapshotLogic +// *********************************************************************** +// *********************************************************************** -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , LoadSnapshotOfLoadsSize ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "LoadSnapshotOf" -// , R"(loadId < loads_.size\(\))"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , LoadSnapshotOfLoadsSize ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "LoadSnapshotOf" + , R"(loadId < loads_.size\(\))"); -// ASSERT_DEATH ( {network_.LoadSnapshotOf ( 10, 0 );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , LoadSnapshotOfLoadsSizeExceptionHandling ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "LoadSnapshotOf" -// , R"(loadId < loads_.size\(\))"); + ASSERT_DEATH ( {network_.LoadSnapshotOf ( 10, 0 );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , LoadSnapshotOfLoadsSizeExceptionHandling ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "LoadSnapshotOf" + , R"(loadId < loads_.size\(\))"); -// try { -// network_.LoadSnapshotOf ( 10, 0 ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.LoadSnapshotOf ( 10, 0 ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// #ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestNetworkEmptyDeathTest -// , LoadSnapshotOfConstNoneDeath ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "LoadSnapshotOf" -// , "loadId != Const::NONE"); +#ifdef EGOA_ENABLE_ASSERTION +TEST_F ( TestNetworkEmptyDeathTest + , LoadSnapshotOfConstNoneDeath ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "LoadSnapshotOf" + , "loadId != Const::NONE"); -// ASSERT_DEATH ( {network_.LoadSnapshotOf ( Const::NONE, 0 );} -// , assertionString ); -// } -// #else -// #ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// TEST_F ( TestNetworkEmpty -// , LoadSnapshotOfConstNoneDeathExceptionHandling ) -// { -// auto assertionString = buildAssertionString ( "PowerGrid.hpp" -// , "PowerGrid" -// , "LoadSnapshotOf" -// , "loadId != Const::NONE"); + ASSERT_DEATH ( {network_.LoadSnapshotOf ( Const::NONE, 0 );} + , assertionString ); +} +#else +#ifdef EGOA_ENABLE_EXCEPTION_HANDLING +TEST_F ( TestNetworkEmpty + , LoadSnapshotOfConstNoneDeathExceptionHandling ) +{ + auto assertionString = buildAssertionString ( "PowerGrid.hpp" + , "PowerGrid" + , "LoadSnapshotOf" + , "loadId != Const::NONE"); -// try { -// network_.LoadSnapshotOf ( Const::NONE, 0 ); -// } catch ( std::runtime_error const & error ) -// { -// EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); -// } catch ( ... ) -// { -// FAIL() << "Expected std::runtime_error with message: " -// << assertionString; -// } -// } -// #endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING -// #endif // ifdef EGOA_ENABLE_ASSERTION + try { + network_.LoadSnapshotOf ( Const::NONE, 0 ); + } catch ( std::runtime_error const & error ) + { + EXPECT_THAT ( error.what(), MatchesRegex(assertionString.c_str()) ); + } catch ( ... ) + { + FAIL() << "Expected std::runtime_error with message: " + << assertionString; + } +} +#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING +#endif // ifdef EGOA_ENABLE_ASSERTION -// TEST_F ( TestPowerGridAcm2018MtsfFigure4a -// , LoadSnapshotOf ) -// { -// EXPECT_EQ ( 8, network_.LoadSnapshotOf ( 0, 0 ) ); -// } +TEST_F ( TestPowerGridAcm2018MtsfFigure4a + , LoadSnapshotOf ) +{ + EXPECT_EQ ( 8, network_.LoadSnapshotOf ( 0, 0 ) ); +} // TEST_F ( TestPowerGridPyPsaExample // , LoadSnapshotOf )