Split test_parser2 into multiple segments

This commit is contained in:
ado 2023-08-03 21:28:41 +02:00
parent 62e19df343
commit 761445bd36
8 changed files with 85 additions and 11 deletions

View File

@ -32,8 +32,9 @@ set(DOCTEST "${FETCHCONTENT_BASE_DIR}/doctest-src")
enable_testing()
foreach(name IN ITEMS test_splitter test_parser test_parser2 test_converter
test_extractions)
foreach(name IN ITEMS test_splitter test_parser test_converter tesst_extractions
test_parser2_segment1 test_parser2_segment2
test_parser2_segment3 test_parser2_segment4)
add_executable("${name}" "${name}.cpp")
target_link_libraries("${name}" PRIVATE ssp::ssp fast_float
doctest::doctest)

View File

@ -3,7 +3,10 @@ test_sources = files([
'test_splitter.cpp',
'test_converter.cpp',
'test_parser.cpp',
'test_parser2.cpp',
'test_parser2_segment1.cpp',
'test_parser2_segment2.cpp',
'test_parser2_segment3.cpp',
'test_parser2_segment4.cpp',
'test_extractions.cpp',
'test_extractions_without_fast_float.cpp',
])

View File

@ -1,9 +1,10 @@
#pragma once
#include <string>
#include <vector>
#include <sstream>
#include <ctime>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <filesystem>
#ifdef CMAKE_GITHUB_CI
#include <doctest/doctest.h>
@ -48,13 +49,12 @@ struct unique_file_name {
const std::string name;
unique_file_name(const std::string& test)
: name{"random_" + test + "_" + std::to_string(i++) + "_" + time_now_rand() +
"_file.csv"} {
: name{"random_" + test + "_" + std::to_string(i++) + "_" +
time_now_rand() + "_file.csv"} {
}
~unique_file_name() {
// TODO uncomment
// std::filesystem::remove(name);
std::filesystem::remove(name);
}
};

View File

@ -612,7 +612,9 @@ void test_option_combinations3() {
} /* namespace */
TEST_CASE("parser test various cases version 2") {
#if 0
TEST_CASE("parser test various cases version 2 segment 1") {
using quote = ss::quote<'"'>;
using escape = ss::escape<'\\'>;
using multiline = ss::multiline;
@ -622,18 +624,27 @@ TEST_CASE("parser test various cases version 2") {
using trimr = ss::trim_right<' '>;
using triml = ss::trim_left<' '>;
// segment 1
test_option_combinations3<>();
test_option_combinations3<escape>();
test_option_combinations3<quote>();
// segment 2
test_option_combinations3<escape, quote>();
test_option_combinations3<escape, multiline>();
test_option_combinations3<quote, multiline>();
// segment 3
test_option_combinations3<escape, quote, multiline>();
test_option_combinations3<escape, quote, multiline_r>();
// segment 4
test_option_combinations<escape, quote, multiline, triml>();
test_option_combinations<escape, quote, multiline, trimr>();
#else
test_option_combinations3<escape, quote, multiline>();
#endif
}
#endif

View File

@ -0,0 +1,13 @@
#include "test_parser2.hpp"
TEST_CASE("parser test various cases version 2 segment 1") {
#ifdef CMAKE_GITHUB_CI
using quote = ss::quote<'"'>;
using escape = ss::escape<'\\'>;
test_option_combinations3<>();
test_option_combinations3<escape>();
test_option_combinations3<quote>();
#endif
}

View File

@ -0,0 +1,14 @@
#include "test_parser2.hpp"
TEST_CASE("parser test various cases version 2 segment 2") {
#ifdef CMAKE_GITHUB_CI
using quote = ss::quote<'"'>;
using escape = ss::escape<'\\'>;
using multiline = ss::multiline;
test_option_combinations3<escape, quote>();
test_option_combinations3<escape, multiline>();
test_option_combinations3<quote, multiline>();
#endif
}

View File

@ -0,0 +1,14 @@
#include "test_parser2.hpp"
TEST_CASE("parser test various cases version 2 segment 3") {
#ifdef CMAKE_GITHUB_CI
using quote = ss::quote<'"'>;
using escape = ss::escape<'\\'>;
using multiline = ss::multiline;
using multiline_r = ss::multiline_restricted<10>;
test_option_combinations3<escape, quote, multiline>();
test_option_combinations3<escape, quote, multiline_r>();
#endif
}

View File

@ -0,0 +1,18 @@
#include "test_parser2.hpp"
TEST_CASE("parser test various cases version 2 segment 4") {
using quote = ss::quote<'"'>;
using escape = ss::escape<'\\'>;
using multiline = ss::multiline;
#ifdef CMAKE_GITHUB_CI
using trimr = ss::trim_right<' '>;
using triml = ss::trim_left<' '>;
test_option_combinations<escape, quote, multiline, triml>();
test_option_combinations<escape, quote, multiline, trimr>();
#else
test_option_combinations3<escape, quote, multiline>();
#endif
}