diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1fb45b4..bb1f7c7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,7 +1,7 @@ +add_subdirectory(Unity) include_directories("${CMAKE_CURRENT_SOURCE_DIR}") add_executable(testing - ./test-main.cpp - ./test-algorithm.cpp - ../src/algorithm.cpp + ./test.cpp ) set_target_properties(testing PROPERTIES LINKER_LANGUAGE CXX) +target_link_libraries(testing unity) diff --git a/test/test-algorithm.cpp b/test/test-algorithm.cpp deleted file mode 100644 index bd2f6ef..0000000 --- a/test/test-algorithm.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include "algorithm.hpp" - -TEST_CASE("Adding Graph") { - Graph testGraph = ReadInGraph("test/input/graphPosLittle"); - INFO("Edge is "); - for (Edge i : testGraph.vertices.at(1).edges) { - INFO(i.destination->nodeNumber << ' '); - } - //REQUIRE( testGraph.nodeCount > 0 ); - SECTION( "Vertices" ) { - //REQUIRE( testGraph.vertices.at(1).nodeNumber == 1 ); - //REQUIRE( testGraph.vertices.at(2).nodeNumber == 2 ); - //REQUIRE( testGraph.vertices.at(3).nodeNumber == 3 ); - //REQUIRE( testGraph.vertices.at(4).nodeNumber == 4 ); - //REQUIRE( testGraph.vertices.at(5).nodeNumber == 5 ); - //REQUIRE( testGraph.vertices.at(6).nodeNumber == 6 ); - //REQUIRE( testGraph.vertices.at(7).nodeNumber == 7 ); - //REQUIRE( testGraph.vertices.at(8).nodeNumber == 8 ); - //REQUIRE( testGraph.vertices.at(9).nodeNumber == 9 ); - //REQUIRE( testGraph.vertices.at(10).nodeNumber == 10 ); - } - SECTION( "Edges" ) { - //std::cout << std::endl; - //REQUIRE( testGraph.vertices.at(1).edges.at(1).destination->nodeNumber == 7 ); - //REQUIRE( testGraph.vertices.at(1).edges.at(2).destination->nodeNumber == 2 ); - } -} diff --git a/test/test-main.cpp b/test/test-main.cpp deleted file mode 100644 index 4ed06df..0000000 --- a/test/test-main.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#define CATCH_CONFIG_MAIN -#include diff --git a/test/test.cpp b/test/test.cpp new file mode 100644 index 0000000..7ec7771 --- /dev/null +++ b/test/test.cpp @@ -0,0 +1,24 @@ +#include "unity.h" +#include "unity_internals.h" + +void setUp() { } +void tearDown() { } + +void test_SUCCESS(void) +{ + TEST_ASSERT_EQUAL_INT(4, 2+2); +} + +void test_FAILURE(void) +{ + TEST_ASSERT_EQUAL_INT(4, 2+3); +} + +int main(void) +{ + UNITY_BEGIN(); + RUN_TEST(test_SUCCESS); + RUN_TEST(test_FAILURE); + return UNITY_END(); +} +