Compare commits
No commits in common. "6ff7c5b43fd4a0391ae7d6dc31774289a3c3bdc3" and "65d16163a6b1e15a952b9c9a6521425c79ad5629" have entirely different histories.
6ff7c5b43f
...
65d16163a6
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
|||||||
[submodule "test/Unity"]
|
|
||||||
path = test/Unity
|
|
||||||
url = https://github.com/ThrowTheSwitch/Unity.git
|
|
@ -1,7 +1,7 @@
|
|||||||
add_subdirectory(Unity)
|
|
||||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
|
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
add_executable(testing
|
add_executable(testing
|
||||||
./test.cpp
|
./test-main.cpp
|
||||||
|
./test-algorithm.cpp
|
||||||
|
../src/algorithm.cpp
|
||||||
)
|
)
|
||||||
set_target_properties(testing PROPERTIES LINKER_LANGUAGE CXX)
|
set_target_properties(testing PROPERTIES LINKER_LANGUAGE CXX)
|
||||||
target_link_libraries(testing unity)
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 2775e1b05875cf45afce7153e36af76ddbfdba26
|
|
28
test/test-algorithm.cpp
Normal file
28
test/test-algorithm.cpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#include <catch2/catch.hpp>
|
||||||
|
#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 );
|
||||||
|
}
|
||||||
|
}
|
2
test/test-main.cpp
Normal file
2
test/test-main.cpp
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#define CATCH_CONFIG_MAIN
|
||||||
|
#include <catch2/catch.hpp>
|
@ -1,24 +0,0 @@
|
|||||||
#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();
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user