diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8ffbb9c..4a32e92 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -3,9 +3,9 @@ project(dropout-dl-tests) set(CMAKE_CXX_STANDARD 17) -add_executable(episode-test test.cpp episode.cpp ../src/episode.cpp) +add_executable(test test.cpp episode_tests.cpp ../src/episode.cpp) -target_link_libraries(episode-test curl sqlite3 gcrypt) +target_link_libraries(test curl sqlite3 gcrypt) message(STATUS "Building Tests") diff --git a/tests/episode.cpp b/tests/episode_tests.cpp similarity index 94% rename from tests/episode.cpp rename to tests/episode_tests.cpp index ecf738d..dd8f264 100644 --- a/tests/episode.cpp +++ b/tests/episode_tests.cpp @@ -1,8 +1,7 @@ // // Created by moss on 9/30/22. // -#include "episode.h" -#include "test.h" +#include "episode_tests.h" namespace dropout_dl { tests test_episode_name_parsing() { @@ -286,37 +285,24 @@ namespace dropout_dl { } } -int main() { +std::vector test_episode() { - dropout_dl::tests name_tests = dropout_dl::test_episode_name_parsing(); + std::vector testss; + + testss.push_back(dropout_dl::test_episode_name_parsing()); - dropout_dl::tests number_tests = dropout_dl::test_episode_number_parsing(); + testss.push_back(dropout_dl::test_episode_number_parsing()); - dropout_dl::tests series_tests = dropout_dl::test_episode_series_name_parsing(); + testss.push_back(dropout_dl::test_episode_series_name_parsing()); - dropout_dl::tests embedded_tests = dropout_dl::test_episode_embedded_url_parsing(); + testss.push_back(dropout_dl::test_episode_embedded_url_parsing()); - dropout_dl::tests config_tests = dropout_dl::test_episode_config_url_parsing(); + testss.push_back(dropout_dl::test_episode_config_url_parsing()); - if (name_tests.success && number_tests.success && series_tests.success && embedded_tests.success && config_tests.success) { - std::cout << TESTNAME << BOLDRED << "Episode Tests" << RESET << std::endl; - } - else { - std::cout << TESTNAME << BOLDGREEN << "Episode Tests" << RESET << std::endl; - } - - name_tests.display(); - - number_tests.display(); - - series_tests.display(); - - embedded_tests.display(); - - config_tests.display(); + return testss; } \ No newline at end of file diff --git a/tests/episode_tests.h b/tests/episode_tests.h new file mode 100644 index 0000000..8bd4e2b --- /dev/null +++ b/tests/episode_tests.h @@ -0,0 +1,10 @@ +// +// Created by moss on 9/30/22. +// +#pragma once + + +#include "episode.h" +#include "test.h" + +std::vector test_episode(); \ No newline at end of file diff --git a/tests/test.cpp b/tests/test.cpp index 0338903..3429895 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -2,6 +2,7 @@ // Created by moss on 9/30/22. // #include "test.h" +#include "episode_tests.h" template void dropout_dl::test::display_result() { @@ -23,4 +24,25 @@ void dropout_dl::tests::display() { for (auto& test : tests_vector) { test.display_result(); } +} + + +int main() { + std::vector episode_tests = test_episode(); + + bool episode_tests_success = true; + for (const auto& test : episode_tests) { + episode_tests_success &= test.success; + } + + if (episode_tests_success) { + std::cout << TESTNAME << BOLDGREEN << "Episode Tests" << std::endl; + } + else { + std::cout << TESTNAME << BOLDRED << "Episode Tests" << std::endl; + } + + for (auto& test : episode_tests) { + test.display(); + } } \ No newline at end of file