Test changes

This commit is contained in:
TriantaTV 2023-09-15 12:43:32 -05:00
parent 044b1cb2e1
commit 6ff7c5b43f
4 changed files with 27 additions and 33 deletions

View File

@ -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)

View File

@ -1,28 +0,0 @@
#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 );
}
}

View File

@ -1,2 +0,0 @@
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>

24
test/test.cpp Normal file
View File

@ -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();
}