Tests: Changed to Having One Test Executable
This commit is contained in:
parent
4ea34e7383
commit
274ddc5cc9
|
@ -3,9 +3,9 @@ project(dropout-dl-tests)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
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")
|
message(STATUS "Building Tests")
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
//
|
//
|
||||||
// Created by moss on 9/30/22.
|
// Created by moss on 9/30/22.
|
||||||
//
|
//
|
||||||
#include "episode.h"
|
#include "episode_tests.h"
|
||||||
#include "test.h"
|
|
||||||
|
|
||||||
namespace dropout_dl {
|
namespace dropout_dl {
|
||||||
tests test_episode_name_parsing() {
|
tests test_episode_name_parsing() {
|
||||||
|
@ -286,37 +285,24 @@ namespace dropout_dl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
std::vector<dropout_dl::tests> test_episode() {
|
||||||
|
|
||||||
dropout_dl::tests name_tests = dropout_dl::test_episode_name_parsing();
|
std::vector<dropout_dl::tests> 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) {
|
return testss;
|
||||||
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();
|
|
||||||
}
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
//
|
||||||
|
// Created by moss on 9/30/22.
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
#include "episode.h"
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
|
std::vector<dropout_dl::tests> test_episode();
|
|
@ -2,6 +2,7 @@
|
||||||
// Created by moss on 9/30/22.
|
// Created by moss on 9/30/22.
|
||||||
//
|
//
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
#include "episode_tests.h"
|
||||||
|
|
||||||
template<typename t>
|
template<typename t>
|
||||||
void dropout_dl::test<t>::display_result() {
|
void dropout_dl::test<t>::display_result() {
|
||||||
|
@ -24,3 +25,24 @@ void dropout_dl::tests::display() {
|
||||||
test.display_result();
|
test.display_result();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::vector<dropout_dl::tests> 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();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue