Skip to content

Commit

Permalink
Activate Graph Tests (#50)
Browse files Browse the repository at this point in the history
* Activate Graph tests
* Remove arguments that are not for the function signature in Graph.hpp
  • Loading branch information
franziska-wegner authored Dec 26, 2023
1 parent 42be5a8 commit 04a58a8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 34 deletions.
3 changes: 2 additions & 1 deletion cmake/CompilerConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ set(PEDANTIC_FLAGS "-pedantic")
# Microsoft Visual Studio ##########################################
####################################################################
if(MSVC)
add_definitions(/MP /DNOMINMAX)
# D:\a\egoa\egoa\tests\DataStructures\Graphs\TestGraph.cpp : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj [D:\a\egoa\egoa\build\tests\TestGraph.vcxproj]
add_definitions(/MP /DNOMINMAX /bigobj)
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /Debug:fastlink")
# https://docs.microsoft.com/en-us/cpp/build/reference/wx-treat-linker-warnings-as-errors?view=vs-2019
set(EGOA_WARNINGS_AS_ERRORS_FLAG "/WX")
Expand Down
6 changes: 3 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ add_test(NAME TestBucket COMMAND TestBucket)
####################################################################################
# Tests for GRAPH data structures ##################################################
####################################################################################
# add_executable(TestGraph DataStructures/Graphs/TestGraph.cpp)
# target_link_libraries(TestGraph EGOA ${GUROBI_LIBRARIES} gtest gtest_main gmock_main)
# add_test(NAME TestGraph COMMAND TestGraph)
add_executable(TestGraph DataStructures/Graphs/TestGraph.cpp)
target_link_libraries(TestGraph EGOA ${GUROBI_LIBRARIES} gtest gtest_main gmock_main)
add_test(NAME TestGraph COMMAND TestGraph)

# add_executable(TestDynamicGraph DataStructures/Graphs/TestDynamicGraph.cpp)
# target_link_libraries(TestDynamicGraph EGOA ${GUROBI_LIBRARIES} gtest gtest_main gmock_main)
Expand Down
46 changes: 16 additions & 30 deletions tests/DataStructures/Graphs/TestGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <algorithm>
#include <functional>

using ::testing::MatchesRegex;

namespace egoa::test {

#pragma mark Name
Expand Down Expand Up @@ -940,7 +942,7 @@ TYPED_TEST( TestGraphStar, EdgesIterateBackwardsConst) {
/// @}

#pragma mark VertexAt
#ifdef EGOA_ENABLE_EXCEPTION_HANDLING
#ifdef EGOA_ENABLE_ASSERTION
TYPED_TEST(TestGraphEmptyDeathTest, VertexAt) {
auto assertionString = this->assertionString("VertexAt", "VertexExists\\(id\\)");
Types::vertexId id = 0;
Expand All @@ -953,9 +955,7 @@ TYPED_TEST( TestGraphStar, EdgesIterateBackwardsConst) {
TYPED_TEST ( TestGraphEmpty
, VertexAtExceptionHandling )
{
auto assertionString = this->assertionString( "Graph.hpp"
, "Graph"
, "VertexAt"
auto assertionString = this->assertionString( "VertexAt"
, "VertexExists\\(id\\)");
Types::vertexId id = 0;
try {
Expand All @@ -979,7 +979,7 @@ TYPED_TEST( TestGraphStar, EdgesIterateBackwardsConst) {
#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING
#endif // ifdef EGOA_ENABLE_ASSERTION

#ifdef EGOA_ENABLE_EXCEPTION_HANDLING
#ifdef EGOA_ENABLE_ASSERTION
TYPED_TEST(TestGraphSingleVertexDeathTest, VertexAt) {
auto assertionString = this->assertionString("VertexAt", "VertexExists\\(id\\)");
Types::vertexId id = this->id_ + 1;
Expand All @@ -991,9 +991,7 @@ TYPED_TEST(TestGraphSingleVertexDeathTest, VertexAt) {
TYPED_TEST ( TestGraphSingleVertex
, VertexAtExceptionHandling )
{
auto assertionString = this->assertionString( "Graph.hpp"
, "Graph"
, "VertexAt"
auto assertionString = this->assertionString( "VertexAt"
, "VertexExists\\(id\\)");
Types::vertexId id = this->id_ + 1;
try {
Expand All @@ -1016,7 +1014,7 @@ TYPED_TEST(TestGraphSingleVertexDeathTest, VertexAt) {
#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING
#endif // ifdef EGOA_ENABLE_ASSERTION

#ifdef EGOA_ENABLE_EXCEPTION_HANDLING
#ifdef EGOA_ENABLE_ASSERTION
TYPED_TEST(TestGraphFourVerticesDeathTest, VertexAt) {
auto assertionString = this->assertionString("VertexAt", "VertexExists\\(id\\)");
Types::vertexId id = Const::NONE;
Expand All @@ -1028,9 +1026,7 @@ TYPED_TEST(TestGraphSingleVertexDeathTest, VertexAt) {
TYPED_TEST ( TestGraphFourVertices
, VertexAtExceptionHandling )
{
auto assertionString = this->assertionString( "Graph.hpp"
, "Graph"
, "VertexAt"
auto assertionString = this->assertionString( "VertexAt"
, "VertexExists\\(id\\)");
Types::vertexId id = Const::NONE;
try {
Expand Down Expand Up @@ -1070,7 +1066,7 @@ TYPED_TEST(TestGraphStar, VertexAt) {
/// @{
#pragma mark NeighborsOf
/// @todo death tests for neighbors of non-existent vertices
#ifdef EGOA_ENABLE_EXCEPTION_HANDLING
#ifdef EGOA_ENABLE_ASSERTION
TYPED_TEST(TestGraphEmptyDeathTest, NeighborsOf) {
auto assertionString = this->assertionString("NeighborsOf", "VertexExists\\(id\\)");
Types::vertexId id = 0;
Expand All @@ -1082,9 +1078,7 @@ TYPED_TEST(TestGraphStar, VertexAt) {
TYPED_TEST ( TestGraphEmpty
, NeighborsOfExceptionHandling )
{
auto assertionString = this->assertionString( "Graph.hpp"
, "Graph"
, "NeighborsOf"
auto assertionString = this->assertionString( "NeighborsOf"
, "VertexExists\\(id\\)");
Types::vertexId id = 0;
try {
Expand All @@ -1107,7 +1101,7 @@ TYPED_TEST(TestGraphStar, VertexAt) {
#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING
#endif // ifdef EGOA_ENABLE_ASSERTION

#ifdef EGOA_ENABLE_EXCEPTION_HANDLING
#ifdef EGOA_ENABLE_ASSERTION
TYPED_TEST(TestGraphSingleVertexDeathTest, NeighborsOf) {
auto assertionString = this->assertionString("NeighborsOf", "VertexExists\\(id\\)");
Types::vertexId id = this->id_ + 1;
Expand All @@ -1119,9 +1113,7 @@ TYPED_TEST(TestGraphStar, VertexAt) {
TYPED_TEST ( TestGraphSingleVertex
, NeighborsOfExceptionHandling )
{
auto assertionString = this->assertionString( "Graph.hpp"
, "Graph"
, "NeighborsOf"
auto assertionString = this->assertionString( "NeighborsOf"
, "VertexExists\\(id\\)");
Types::vertexId id = this->id_ + 1;
try {
Expand All @@ -1144,7 +1136,7 @@ TYPED_TEST(TestGraphStar, VertexAt) {
#endif // ifdef EGOA_ENABLE_EXCEPTION_HANDLING
#endif // ifdef EGOA_ENABLE_ASSERTION

#ifdef EGOA_ENABLE_EXCEPTION_HANDLING
#ifdef EGOA_ENABLE_ASSERTION
TYPED_TEST(TestGraphFourVerticesDeathTest, NeighborsOf) {
auto assertionString = this->assertionString("NeighborsOf", "VertexExists\\(id\\)");
Types::vertexId id = Const::NONE;
Expand All @@ -1156,9 +1148,7 @@ TYPED_TEST(TestGraphStar, VertexAt) {
TYPED_TEST ( TestGraphFourVertices
, NeighborsOfExceptionHandling )
{
auto assertionString = this->assertionString( "Graph.hpp"
, "Graph"
, "NeighborsOf"
auto assertionString = this->assertionString( "NeighborsOf"
, "VertexExists\\(id\\)");
Types::vertexId id = Const::NONE;
try {
Expand Down Expand Up @@ -2175,9 +2165,7 @@ TYPED_TEST(TestGraphEmptyDeathTest, ForAllEdgesAt) {
TYPED_TEST ( TestGraphEmpty
, ForAllEdgesAtExceptionHandling )
{
auto assertionString = this->assertionString( "Graph.hpp"
, "Graph"
, "for_all_edges_at"
auto assertionString = this->assertionString( "for_all_edges_at"
, "VertexExists\\(vertexId\\)");
Types::vertexId nonexistentId = 3;
try {
Expand Down Expand Up @@ -2216,9 +2204,7 @@ TYPED_TEST(TestGraphEmptyDeathTest, ForAllEdgesAtConst) {
TYPED_TEST ( TestGraphEmpty
, ForAllEdgesAtConstExceptionHandling )
{
auto assertionString = this->assertionString( "Graph.hpp"
, "Graph"
, "for_all_edges_at"
auto assertionString = this->assertionString( "for_all_edges_at"
, "VertexExists\\(vertexId\\)");
Types::vertexId nonexistentId = 3;
try {
Expand Down

0 comments on commit 04a58a8

Please sign in to comment.