mirror of
https://github.com/red0124/ssp.git
synced 2025-01-23 04:55:20 +01:00
Split test_parser2 into multiple segments
This commit is contained in:
parent
62e19df343
commit
761445bd36
@ -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)
|
||||
|
@ -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',
|
||||
])
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
13
test/test_parser2_segment1.cpp
Normal file
13
test/test_parser2_segment1.cpp
Normal 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
|
||||
}
|
||||
|
14
test/test_parser2_segment2.cpp
Normal file
14
test/test_parser2_segment2.cpp
Normal 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
|
||||
}
|
||||
|
14
test/test_parser2_segment3.cpp
Normal file
14
test/test_parser2_segment3.cpp
Normal 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
|
||||
}
|
||||
|
18
test/test_parser2_segment4.cpp
Normal file
18
test/test_parser2_segment4.cpp
Normal 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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user