From 4cf0d70595425fe0b1dcc1a3a115233da972906d Mon Sep 17 00:00:00 2001 From: Moss Date: Fri, 30 Sep 2022 22:49:54 -0400 Subject: [PATCH] Tests: Added Series Tests I forgot to actually include the files the last time I commited this. Oops. --- tests/series_tests.cpp | 67 ++++++++++++++++++++++++++++++++++++++++++ tests/series_tests.h | 9 ++++++ 2 files changed, 76 insertions(+) create mode 100644 tests/series_tests.cpp create mode 100644 tests/series_tests.h diff --git a/tests/series_tests.cpp b/tests/series_tests.cpp new file mode 100644 index 0000000..5bf62c6 --- /dev/null +++ b/tests/series_tests.cpp @@ -0,0 +1,67 @@ +// +// Created by moss on 9/30/22. +// + +#include "series_tests.h" + +namespace dropout_dl { + tests test_series_name_parsing() { + std::vector> out; + + std::string (*test_function)(const std::string&) = series::get_series_name; + + std::string base_test_solution = "Base Test Title"; + std::string base_test = "

\n" + + base_test_solution + + "\n

"; + + out.emplace_back("Basic Series Name Parsing", test_function, base_test, base_test_solution); + + + std::string multiple_header_test_solution = "Multi Header Test Title"; + std::string multiple_header_test = "

\n" + "Header without class or strong\n" + "

\n" + "

\n" + "Header with incorrect classes" + "

\n" + "

\n" + + multiple_header_test_solution + + "

\n" + "

\n" + "Valid Header After Correct Title\n" + "

"; + + + out.emplace_back("Multi Header Series Name Parsing", test_function, multiple_header_test, multiple_header_test_solution); + + + std::string no_valid_name_test_solution = "ERROR"; + std::string no_valid_name_test = "

\n" + "Header without class or strong\n" + "

\n" + "

\n" + "Header with incorrect classes" + "

\n"; + + + out.emplace_back("No Valid Series Name Parsing", test_function, no_valid_name_test, no_valid_name_test_solution); + + + + std::string html_character_test_solution = "'&;"; + std::string html_character_test = "

\n" + " '&;\n" + "

"; + + + out.emplace_back("Html Character Series Name Parsing", test_function, html_character_test, html_character_test_solution); + + + return {"Series Name Parsing", out}; + } +} + +std::vector test_series() { + return {dropout_dl::test_series_name_parsing()}; +} \ No newline at end of file diff --git a/tests/series_tests.h b/tests/series_tests.h new file mode 100644 index 0000000..4ab7426 --- /dev/null +++ b/tests/series_tests.h @@ -0,0 +1,9 @@ +// +// Created by moss on 9/30/22. +// +#pragma once + +#include "../src/series.h" +#include "test.h" + +std::vector test_series(); \ No newline at end of file