mirror of
https://github.com/red0124/ssp.git
synced 2025-12-16 14:49:56 +01:00
Compare commits
7 Commits
50de5b3a5a
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
043e66f83f | ||
|
|
11324e420e | ||
|
|
c708d93db3 | ||
|
|
41ae9d98c7 | ||
| 53c5b779d4 | |||
| 107a122718 | |||
|
|
55d0a4e598 |
6
.github/workflows/macos-apple-clang.yml
vendored
6
.github/workflows/macos-apple-clang.yml
vendored
@@ -25,10 +25,10 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
xcode: ['13.4.1', '14.1']
|
xcode: ['15.2']
|
||||||
type: [Release, Debug]
|
type: [Release, Debug]
|
||||||
|
|
||||||
runs-on: macos-12
|
runs-on: macos-latest
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DEVELOPER_DIR: /Applications/Xcode_${{matrix.xcode}}.app/Contents/Developer
|
DEVELOPER_DIR: /Applications/Xcode_${{matrix.xcode}}.app/Contents/Developer
|
||||||
@@ -42,7 +42,7 @@ jobs:
|
|||||||
id: cores
|
id: cores
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: script/ci_install_deps.sh
|
run: script/ci_install_deps.sh sudo
|
||||||
|
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: cmake -S test -B build -DCMAKE_BUILD_TYPE=${{matrix.type}}
|
run: cmake -S test -B build -DCMAKE_BUILD_TYPE=${{matrix.type}}
|
||||||
|
|||||||
77
.github/workflows/ubuntu-latest-icc.yml
vendored
77
.github/workflows/ubuntu-latest-icc.yml
vendored
@@ -1,77 +0,0 @@
|
|||||||
name: ubuntu-latest-icc-ci
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- feature/**
|
|
||||||
- improvement/**
|
|
||||||
- bugfix/**
|
|
||||||
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- feature/**
|
|
||||||
- improvement/**
|
|
||||||
- bugfix/**
|
|
||||||
|
|
||||||
env:
|
|
||||||
LINUX_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/17431/l_BaseKit_p_2021.1.0.2659_offline.sh
|
|
||||||
LINUX_HPCKIT_URL:
|
|
||||||
https://registrationcenter-download.intel.com/akdlm/irc_nas/17427/l_HPCKit_p_2021.1.0.2684_offline.sh
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
icc_tests:
|
|
||||||
if: >-
|
|
||||||
! contains(toJSON(github.event.commits.*.message), '[skip ci]') &&
|
|
||||||
! contains(toJSON(github.event.commits.*.message), '[skip github]')
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
container:
|
|
||||||
image: gcc:10
|
|
||||||
options: -v /usr/local:/host_usr_local
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: cache install
|
|
||||||
id: cache-install
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
/opt/intel/oneapi/compiler
|
|
||||||
key: >-
|
|
||||||
install-${{env.LINUX_HPCKIT_URL}}-
|
|
||||||
${{env.LINUX_CPP_COMPONENTS_WEB}}-
|
|
||||||
compiler-${{hashFiles('**/scripts/cache_exclude_linux.sh')}}
|
|
||||||
|
|
||||||
- name: Install icc
|
|
||||||
run: >-
|
|
||||||
script/ci_install_icc.sh $LINUX_HPCKIT_URL $LINUX_CPP_COMPONENTS_WEB
|
|
||||||
|
|
||||||
- name: CMake
|
|
||||||
run: echo "/host_usr_local/bin" >> $GITHUB_PATH
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: script/ci_install_deps.sh
|
|
||||||
|
|
||||||
- name: Configure
|
|
||||||
run: >-
|
|
||||||
source script/ci_setup_icc.sh &&
|
|
||||||
cmake -S test -B build -D CMAKE_BUILD_TYPE=Debug
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: >-
|
|
||||||
source script/ci_setup_icc.sh &&
|
|
||||||
cmake --build build -j ${{steps.cores.outputs.count}}
|
|
||||||
|
|
||||||
- name: Run
|
|
||||||
working-directory: build
|
|
||||||
run: ctest --output-on-failure
|
|
||||||
5
.github/workflows/win-msvc.yml
vendored
5
.github/workflows/win-msvc.yml
vendored
@@ -31,14 +31,11 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
config:
|
config:
|
||||||
- os: windows-2019
|
|
||||||
vs: "Visual Studio 16 2019"
|
|
||||||
|
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
vs: "Visual Studio 17 2022"
|
vs: "Visual Studio 17 2022"
|
||||||
|
|
||||||
build: [Debug, Release]
|
build: [Debug, Release]
|
||||||
platform: [Win32, x64]
|
platform: [x64]
|
||||||
|
|
||||||
runs-on: ${{matrix.config.os}}
|
runs-on: ${{matrix.config.os}}
|
||||||
|
|
||||||
|
|||||||
7
.github/workflows/win-msys2-clang.yml
vendored
7
.github/workflows/win-msys2-clang.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
os: [windows-2019, windows-latest]
|
os: [windows-2025, windows-latest]
|
||||||
type: [Release, Debug]
|
type: [Release, Debug]
|
||||||
config:
|
config:
|
||||||
- msystem: "MINGW64"
|
- msystem: "MINGW64"
|
||||||
@@ -39,11 +39,6 @@ jobs:
|
|||||||
git mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja
|
git mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja
|
||||||
mingw-w64-x86_64-clang
|
mingw-w64-x86_64-clang
|
||||||
|
|
||||||
- msystem: "MINGW32"
|
|
||||||
install: >-
|
|
||||||
git mingw-w64-i686-cmake mingw-w64-i686-ninja
|
|
||||||
mingw-w64-i686-clang
|
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
name: "${{matrix.config.msystem}}: ${{matrix.os}}: ${{matrix.type}}"
|
name: "${{matrix.config.msystem}}: ${{matrix.os}}: ${{matrix.type}}"
|
||||||
|
|||||||
7
.github/workflows/win-msys2-gcc.yml
vendored
7
.github/workflows/win-msys2-gcc.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
os: [windows-2019, windows-latest]
|
os: [windows-2025, windows-latest]
|
||||||
type: [Release, Debug]
|
type: [Release, Debug]
|
||||||
config:
|
config:
|
||||||
- msystem: "MINGW64"
|
- msystem: "MINGW64"
|
||||||
@@ -39,11 +39,6 @@ jobs:
|
|||||||
git mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja
|
git mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja
|
||||||
mingw-w64-x86_64-gcc
|
mingw-w64-x86_64-gcc
|
||||||
|
|
||||||
- msystem: "MINGW32"
|
|
||||||
install: >-
|
|
||||||
git mingw-w64-i686-cmake mingw-w64-i686-ninja
|
|
||||||
mingw-w64-i686-gcc
|
|
||||||
|
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
name: "${{matrix.config.msystem}}: ${{matrix.os}}: ${{matrix.type}}"
|
name: "${{matrix.config.msystem}}: ${{matrix.os}}: ${{matrix.type}}"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.14)
|
|||||||
|
|
||||||
project(
|
project(
|
||||||
ssp
|
ssp
|
||||||
VERSION 1.7.2
|
VERSION 1.8.0
|
||||||
DESCRIPTION "csv parser"
|
DESCRIPTION "csv parser"
|
||||||
HOMEPAGE_URL "https://github.com/red0124/ssp"
|
HOMEPAGE_URL "https://github.com/red0124/ssp"
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
|
|||||||
57
README.md
57
README.md
@@ -9,15 +9,14 @@
|
|||||||
|
|
||||||
[](https://opensource.org/licenses/MIT)
|
[](https://opensource.org/licenses/MIT)
|
||||||
[](https://coveralls.io/github/red0124/ssp?branch=master)
|
[](https://coveralls.io/github/red0124/ssp?branch=master)
|
||||||
[](https://github.com/red0124/ssp/actions/workflows/fuzz.yml)
|
[](https://github.com/red0124/ssp/actions/workflows/fuzz.yml)
|
||||||
[](https://github.com/red0124/ssp/actions/workflows/single-header.yml)
|
[](https://github.com/red0124/ssp/actions/workflows/single-header.yml)
|
||||||
[](https://github.com/red0124/ssp/actions/workflows/ubuntu-latest-gcc.yml)
|
[](https://github.com/red0124/ssp/actions/workflows/ubuntu-latest-gcc.yml)
|
||||||
[](https://github.com/red0124/ssp/actions/workflows/ubuntu-latest-clang.yml)
|
[](https://github.com/red0124/ssp/actions/workflows/ubuntu-latest-clang.yml)
|
||||||
[](https://github.com/red0124/ssp/actions/workflows/ubuntu-latest-icc.yml)
|
[](https://github.com/red0124/ssp/actions/workflows/win-msys2-gcc.yml)
|
||||||
[](https://github.com/red0124/ssp/actions/workflows/win-msys2-gcc.yml)
|
[](https://github.com/red0124/ssp/actions/workflows/win-msys2-clang.yml)
|
||||||
[](https://github.com/red0124/ssp/actions/workflows/win-msys2-clang.yml)
|
[](https://github.com/red0124/ssp/actions/workflows/win-msvc.yml)
|
||||||
[](https://github.com/red0124/ssp/actions/workflows/win-msvc.yml)
|
[](https://github.com/red0124/ssp/actions/workflows/macos-apple-clang.yml)
|
||||||
[](https://github.com/red0124/ssp/actions/workflows/macos-apple-clang.yml)
|
|
||||||
|
|
||||||
A header only CSV parser which is fast and versatile with modern C++ API. Requires compiler with C++17 support. [Can also be used to efficiently convert strings to specific types.](#the-converter)
|
A header only CSV parser which is fast and versatile with modern C++ API. Requires compiler with C++17 support. [Can also be used to efficiently convert strings to specific types.](#the-converter)
|
||||||
|
|
||||||
@@ -74,7 +73,7 @@ Bill (Heath) Gates 65 3.3
|
|||||||
|
|
||||||
# Single header
|
# Single header
|
||||||
|
|
||||||
The library can be used with a single header file **`ssp.hpp`**, but it suffers a slight performance loss when converting floating point values since the **`fast_float`** library is not present within the file.
|
The library can be used with a single header file **`ssp.hpp`**, but it suffers a significant performance loss when converting floating point values since the **`fast_float`** library is not present within the file.
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
@@ -92,7 +91,7 @@ The library supports [CMake](#Cmake) and [meson](#Meson) build systems
|
|||||||
|
|
||||||
## Headers
|
## Headers
|
||||||
|
|
||||||
The parser can be told to use only certain columns by parsing the header. This can be done by using the **`use_fields`** method. It accepts any number of string-like arguments or even an **`std::vector<std::string>`** with the field names. If any of the fields are not found within the header or if any fields are defined multiple times it will result in an error.
|
The parser can be told to use only certain columns by parsing the header. This can be done with the **`use_fields`** method. It accepts any number of string-like arguments or even an **`std::vector<std::string>`** with the field names. If any of the fields are not found within the header or if any fields are defined multiple times it will result in an error.
|
||||||
```shell
|
```shell
|
||||||
$ cat students_with_header.csv
|
$ cat students_with_header.csv
|
||||||
Id,Age,Grade
|
Id,Age,Grade
|
||||||
@@ -116,7 +115,7 @@ James Bailey 2.5
|
|||||||
Brian S. Wolfe 1.9
|
Brian S. Wolfe 1.9
|
||||||
Bill (Heath) Gates 3.3
|
Bill (Heath) Gates 3.3
|
||||||
```
|
```
|
||||||
The header can be ignored using the **`ss::ignore_header`** [setup](#Setup) option or by calling the **`ignore_next`** method after the parser has been constructed.
|
The header can be ignored using the **`ss::ignore_header`** [setup](#Setup) option or by calling the **`ignore_next`** method after the parser has been constructed. If the header has been ignored calling any method related to header usage will result in a compilation error.
|
||||||
```cpp
|
```cpp
|
||||||
ss::parser<ss::ignore_header> p{file_name};
|
ss::parser<ss::ignore_header> p{file_name};
|
||||||
```
|
```
|
||||||
@@ -124,10 +123,10 @@ The fields with which the parser works with can be modified at any given time. T
|
|||||||
```cpp
|
```cpp
|
||||||
// ...
|
// ...
|
||||||
ss::parser<ss::throw_on_error> p{"students_with_header.csv"};
|
ss::parser<ss::throw_on_error> p{"students_with_header.csv"};
|
||||||
p.use_fields("Id", "Grade");
|
p.use_fields("Grade");
|
||||||
|
|
||||||
const auto& [id, grade] = p.get_next<std::string, float>();
|
const auto& grade = p.get_next<std::string>();
|
||||||
std::cout << id << ' ' << grade << std::endl;
|
std::cout << grade << std::endl;
|
||||||
|
|
||||||
if (p.field_exists("Id")) {
|
if (p.field_exists("Id")) {
|
||||||
p.use_fields("Grade", "Id");
|
p.use_fields("Grade", "Id");
|
||||||
@@ -139,10 +138,32 @@ The fields with which the parser works with can be modified at any given time. T
|
|||||||
```
|
```
|
||||||
```shell
|
```shell
|
||||||
$ ./a.out
|
$ ./a.out
|
||||||
James Bailey 2.5
|
2.5
|
||||||
40 Brian S. Wolfe
|
1.9 Brian S. Wolfe
|
||||||
65 Bill (Heath) Gates
|
3.3 Bill (Heath) Gates
|
||||||
```
|
```
|
||||||
|
The header is parsed with the same rules as other rows, the only difference is that **`multiline`** will be disabled when parsing the header. To get the data that is
|
||||||
|
present in the header as a **`std::vector<std::string>`**, the **`header`** method can be used, and to get the header line before it has been parsed, the **`raw_header`** method can be used:
|
||||||
|
```cpp
|
||||||
|
// ...
|
||||||
|
ss::parser<ss::throw_on_error> p{"students_with_header.csv"};
|
||||||
|
|
||||||
|
std::cout << p.raw_header() << std::endl;
|
||||||
|
|
||||||
|
for (const auto& field: p.header()) {
|
||||||
|
std::cout << "> " << field << std::endl;
|
||||||
|
}
|
||||||
|
// ...
|
||||||
|
```
|
||||||
|
```shell
|
||||||
|
$ ./a.out
|
||||||
|
Id,Age,Grade
|
||||||
|
> Id
|
||||||
|
> Age
|
||||||
|
> Grade
|
||||||
|
```
|
||||||
|
Methods related to headers can also fail, the error handling of these is done in the same way as for other methods.
|
||||||
|
|
||||||
## Conversions
|
## Conversions
|
||||||
An alternate loop to the example above would look like:
|
An alternate loop to the example above would look like:
|
||||||
```cpp
|
```cpp
|
||||||
|
|||||||
@@ -531,10 +531,6 @@ private:
|
|||||||
|
|
||||||
[[nodiscard]] bool strict_split(header_splitter& splitter,
|
[[nodiscard]] bool strict_split(header_splitter& splitter,
|
||||||
std::string& header) {
|
std::string& header) {
|
||||||
if (header.empty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if constexpr (throw_on_error) {
|
if constexpr (throw_on_error) {
|
||||||
try {
|
try {
|
||||||
splitter.split(header.data(), reader_.delim_);
|
splitter.split(header.data(), reader_.delim_);
|
||||||
@@ -562,11 +558,6 @@ private:
|
|||||||
|
|
||||||
for (const auto& [begin, end] : splitter.get_split_data()) {
|
for (const auto& [begin, end] : splitter.get_split_data()) {
|
||||||
std::string field{begin, end};
|
std::string field{begin, end};
|
||||||
if (field.empty()) {
|
|
||||||
handle_error_duplicate_header_field(field);
|
|
||||||
header_.clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (std::find(header_.begin(), header_.end(), field) !=
|
if (std::find(header_.begin(), header_.end(), field) !=
|
||||||
header_.end()) {
|
header_.end()) {
|
||||||
handle_error_duplicate_header_field(field);
|
handle_error_duplicate_header_field(field);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ project(
|
|||||||
'cpp_std=c++17',
|
'cpp_std=c++17',
|
||||||
'buildtype=debugoptimized',
|
'buildtype=debugoptimized',
|
||||||
'wrap_mode=forcefallback'],
|
'wrap_mode=forcefallback'],
|
||||||
version: '1.7.2',
|
version: '1.8.0',
|
||||||
meson_version:'>=0.54.0')
|
meson_version:'>=0.54.0')
|
||||||
|
|
||||||
fast_float_dep = dependency('fast_float')
|
fast_float_dep = dependency('fast_float')
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
JOBS=4
|
JOBS=4
|
||||||
BUILD_TYPE=Debug
|
BUILD_TYPE=Debug
|
||||||
|
|
||||||
set -eux
|
set -ex
|
||||||
|
|
||||||
git clone https://github.com/red0124/doctest -b master --depth 1
|
git clone https://github.com/red0124/doctest -b master --depth 1
|
||||||
|
|
||||||
@@ -12,6 +12,10 @@ cmake -S doctest -B doctest/build \
|
|||||||
-D DOCTEST_WITH_MAIN_IN_STATIC_LIB=NO \
|
-D DOCTEST_WITH_MAIN_IN_STATIC_LIB=NO \
|
||||||
-D DOCTEST_WITH_TESTS=NO
|
-D DOCTEST_WITH_TESTS=NO
|
||||||
|
|
||||||
|
if [[ "${1}" == "sudo" ]]; then
|
||||||
|
sudo cmake --build doctest/build --config ${BUILD_TYPE} --target install -j ${JOBS}
|
||||||
|
else
|
||||||
cmake --build doctest/build --config ${BUILD_TYPE} --target install -j ${JOBS}
|
cmake --build doctest/build --config ${BUILD_TYPE} --target install -j ${JOBS}
|
||||||
|
fi
|
||||||
|
|
||||||
rm -rf doctest
|
rm -rf doctest
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# SPDX-FileCopyrightText: 2020 Intel Corporation
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
URL=$1
|
|
||||||
COMPONENTS=$2
|
|
||||||
|
|
||||||
curl --output webimage.sh --url "$URL" --retry 5 --retry-delay 5
|
|
||||||
chmod +x webimage.sh
|
|
||||||
./webimage.sh -x -f webimage_extracted --log extract.log
|
|
||||||
rm -rf webimage.sh
|
|
||||||
WEBIMAGE_NAME=$(ls -1 webimage_extracted/)
|
|
||||||
if [ -z "$COMPONENTS" ]; then
|
|
||||||
webimage_extracted/"$WEBIMAGE_NAME"/bootstrapper -s --action install --eula=accept --continue-with-optional-error=yes --log-dir=.
|
|
||||||
installer_exit_code=$?
|
|
||||||
else
|
|
||||||
webimage_extracted/"$WEBIMAGE_NAME"/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --continue-with-optional-error=yes --log-dir=.
|
|
||||||
installer_exit_code=$?
|
|
||||||
fi
|
|
||||||
rm -rf webimage_extracted
|
|
||||||
exit $installer_exit_code
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# SPDX-FileCopyrightText: 2020 Intel Corporation
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
#shellcheck disable=SC2010
|
|
||||||
LATEST_VERSION=$(ls -1 /opt/intel/oneapi/compiler/ | grep -v latest | sort | tail -1)
|
|
||||||
# shellcheck source=/dev/null
|
|
||||||
source /opt/intel/oneapi/compiler/"$LATEST_VERSION"/env/vars.sh
|
|
||||||
CXX=dpcpp
|
|
||||||
9
ssp.hpp
9
ssp.hpp
@@ -2805,10 +2805,6 @@ private:
|
|||||||
|
|
||||||
[[nodiscard]] bool strict_split(header_splitter& splitter,
|
[[nodiscard]] bool strict_split(header_splitter& splitter,
|
||||||
std::string& header) {
|
std::string& header) {
|
||||||
if (header.empty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if constexpr (throw_on_error) {
|
if constexpr (throw_on_error) {
|
||||||
try {
|
try {
|
||||||
splitter.split(header.data(), reader_.delim_);
|
splitter.split(header.data(), reader_.delim_);
|
||||||
@@ -2836,11 +2832,6 @@ private:
|
|||||||
|
|
||||||
for (const auto& [begin, end] : splitter.get_split_data()) {
|
for (const auto& [begin, end] : splitter.get_split_data()) {
|
||||||
std::string field{begin, end};
|
std::string field{begin, end};
|
||||||
if (field.empty()) {
|
|
||||||
handle_error_duplicate_header_field(field);
|
|
||||||
header_.clear();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (std::find(header_.begin(), header_.end(), field) !=
|
if (std::find(header_.begin(), header_.end(), field) !=
|
||||||
header_.end()) {
|
header_.end()) {
|
||||||
handle_error_duplicate_header_field(field);
|
handle_error_duplicate_header_field(field);
|
||||||
|
|||||||
@@ -33,10 +33,11 @@ set(DOCTEST "${FETCHCONTENT_BASE_DIR}/doctest-src")
|
|||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
foreach(name IN ITEMS test_splitter test_parser1_1 test_parser1_2
|
foreach(name IN ITEMS test_splitter test_parser1_1 test_parser1_2
|
||||||
test_parser1_3 test_parser1_4 test_converter
|
test_parser1_3 test_parser1_4 test_parser1_5
|
||||||
test_extractions test_parser2_1 test_parser2_2
|
test_converter test_extractions test_parser2_1
|
||||||
test_parser2_3 test_parser2_4 test_parser2_5
|
test_parser2_2 test_parser2_3 test_parser2_4
|
||||||
test_parser2_6 test_extractions_without_fast_float)
|
test_parser2_5 test_parser2_6
|
||||||
|
test_extractions_without_fast_float)
|
||||||
add_executable("${name}" "${name}.cpp")
|
add_executable("${name}" "${name}.cpp")
|
||||||
target_link_libraries("${name}" PRIVATE ssp::ssp fast_float
|
target_link_libraries("${name}" PRIVATE ssp::ssp fast_float
|
||||||
doctest::doctest)
|
doctest::doctest)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ tests = [
|
|||||||
'parser1_2',
|
'parser1_2',
|
||||||
'parser1_3',
|
'parser1_3',
|
||||||
'parser1_4',
|
'parser1_4',
|
||||||
|
'parser1_5',
|
||||||
'splitter',
|
'splitter',
|
||||||
'converter',
|
'converter',
|
||||||
'extractions',
|
'extractions',
|
||||||
|
|||||||
@@ -178,7 +178,8 @@ void test_invalid_fields(const std::vector<std::string>& lines,
|
|||||||
|
|
||||||
auto check_header = [&lines](auto& p) {
|
auto check_header = [&lines](auto& p) {
|
||||||
if (lines.empty()) {
|
if (lines.empty()) {
|
||||||
CHECK(p.header().empty());
|
CHECK_EQ(p.header().size(), 1);
|
||||||
|
CHECK_EQ(p.header().at(0), "");
|
||||||
CHECK_EQ(merge_header(p.header(), ","), p.raw_header());
|
CHECK_EQ(merge_header(p.header(), ","), p.raw_header());
|
||||||
} else {
|
} else {
|
||||||
CHECK_EQ(lines[0], merge_header(p.header()));
|
CHECK_EQ(lines[0], merge_header(p.header()));
|
||||||
@@ -263,7 +264,7 @@ void test_invalid_fields(const std::vector<std::string>& lines,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE_TEMPLATE("test invalid fheader fields usage", T,
|
TEST_CASE_TEMPLATE("test invalid header fields usage", T,
|
||||||
ParserOptionCombinations) {
|
ParserOptionCombinations) {
|
||||||
test_invalid_fields<T>({}, {});
|
test_invalid_fields<T>({}, {});
|
||||||
|
|
||||||
@@ -397,178 +398,3 @@ TEST_CASE_TEMPLATE("test invalid rows with header", T,
|
|||||||
CHECK_EQ(merge_header(p.header()), p.raw_header());
|
CHECK_EQ(merge_header(p.header()), p.raw_header());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE_TEMPLATE("test invalid header", T, ParserOptionCombinations) {
|
|
||||||
constexpr auto buffer_mode = T::BufferMode::value;
|
|
||||||
using ErrorMode = typename T::ErrorMode;
|
|
||||||
|
|
||||||
unique_file_name f{"invalid_header"};
|
|
||||||
|
|
||||||
// Empty header
|
|
||||||
{
|
|
||||||
std::ofstream out{f.name};
|
|
||||||
out << "" << std::endl;
|
|
||||||
out << "1" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto [p, _] = make_parser<buffer_mode, ErrorMode>(f.name);
|
|
||||||
CHECK(p.header().empty());
|
|
||||||
CHECK_EQ(merge_header(p.header()), p.raw_header());
|
|
||||||
CHECK(p.valid());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unterminated quote in header
|
|
||||||
{
|
|
||||||
std::ofstream out{f.name};
|
|
||||||
out << "\"Int" << std::endl;
|
|
||||||
out << "1" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto [p, _] =
|
|
||||||
make_parser<buffer_mode, ErrorMode, ss::quote<'"'>>(f.name);
|
|
||||||
auto command = [&p = p] { std::ignore = p.header(); };
|
|
||||||
expect_error_on_command(p, command);
|
|
||||||
CHECK_EQ(p.raw_header(), "\"Int");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto [p, _] =
|
|
||||||
make_parser<buffer_mode, ErrorMode, ss::quote<'"'>, ss::multiline>(
|
|
||||||
f.name);
|
|
||||||
auto command = [&p = p] { std::ignore = p.header(); };
|
|
||||||
expect_error_on_command(p, command);
|
|
||||||
CHECK_EQ(p.raw_header(), "\"Int");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto [p, _] = make_parser<buffer_mode, ErrorMode, ss::quote<'"'>,
|
|
||||||
ss::escape<'\\'>, ss::multiline>(f.name);
|
|
||||||
auto command = [&p = p] { std::ignore = p.header(); };
|
|
||||||
expect_error_on_command(p, command);
|
|
||||||
CHECK_EQ(p.raw_header(), "\"Int");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unterminated escape in header
|
|
||||||
{
|
|
||||||
std::ofstream out{f.name};
|
|
||||||
out << "Int\\" << std::endl;
|
|
||||||
out << "1" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto [p, _] =
|
|
||||||
make_parser<buffer_mode, ErrorMode, ss::escape<'\\'>>(f.name);
|
|
||||||
auto command = [&p = p] { std::ignore = p.header(); };
|
|
||||||
expect_error_on_command(p, command);
|
|
||||||
CHECK_EQ(p.raw_header(), "Int\\");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto [p, _] = make_parser<buffer_mode, ErrorMode, ss::escape<'\\'>,
|
|
||||||
ss::multiline>(f.name);
|
|
||||||
auto command = [&p = p] { std::ignore = p.header(); };
|
|
||||||
expect_error_on_command(p, command);
|
|
||||||
CHECK_EQ(p.raw_header(), "Int\\");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto [p, _] = make_parser<buffer_mode, ErrorMode, ss::escape<'\\'>,
|
|
||||||
ss::quote<'"'>, ss::multiline>(f.name);
|
|
||||||
auto command = [&p = p] { std::ignore = p.header(); };
|
|
||||||
expect_error_on_command(p, command);
|
|
||||||
CHECK_EQ(p.raw_header(), "Int\\");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
void test_ignore_empty(const std::vector<X>& data) {
|
|
||||||
constexpr auto buffer_mode = T::BufferMode::value;
|
|
||||||
using ErrorMode = typename T::ErrorMode;
|
|
||||||
|
|
||||||
unique_file_name f{"ignore_empty"};
|
|
||||||
make_and_write(f.name, data);
|
|
||||||
|
|
||||||
std::vector<X> expected;
|
|
||||||
for (const auto& d : data) {
|
|
||||||
if (d.s != X::empty) {
|
|
||||||
expected.push_back(d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto [p, _] =
|
|
||||||
make_parser<buffer_mode, ErrorMode, ss::ignore_empty>(f.name, ",");
|
|
||||||
|
|
||||||
std::vector<X> i;
|
|
||||||
for (const auto& a : p.template iterate<X>()) {
|
|
||||||
i.push_back(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
CHECK_EQ(i, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
auto [p, _] = make_parser<buffer_mode, ErrorMode>(f.name, ",");
|
|
||||||
std::vector<X> i;
|
|
||||||
size_t n = 0;
|
|
||||||
while (!p.eof()) {
|
|
||||||
try {
|
|
||||||
++n;
|
|
||||||
const auto& a = p.template get_next<X>();
|
|
||||||
if (data.at(n - 1).s == X::empty) {
|
|
||||||
CHECK_FALSE(p.valid());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
i.push_back(a);
|
|
||||||
} catch (...) {
|
|
||||||
CHECK_EQ(data.at(n - 1).s, X::empty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CHECK_EQ(i, expected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE_TEMPLATE("test various cases with empty lines", T,
|
|
||||||
ParserOptionCombinations) {
|
|
||||||
test_ignore_empty<T>(
|
|
||||||
{{1, 2, "x"}, {3, 4, "y"}, {9, 10, "v"}, {11, 12, "w"}});
|
|
||||||
|
|
||||||
test_ignore_empty<T>(
|
|
||||||
{{1, 2, X::empty}, {3, 4, "y"}, {9, 10, "v"}, {11, 12, "w"}});
|
|
||||||
|
|
||||||
test_ignore_empty<T>(
|
|
||||||
{{1, 2, "x"}, {3, 4, "y"}, {9, 10, "v"}, {11, 12, X::empty}});
|
|
||||||
|
|
||||||
test_ignore_empty<T>(
|
|
||||||
{{1, 2, "x"}, {5, 6, X::empty}, {9, 10, "v"}, {11, 12, "w"}});
|
|
||||||
|
|
||||||
test_ignore_empty<T>(
|
|
||||||
{{1, 2, X::empty}, {5, 6, X::empty}, {9, 10, "v"}, {11, 12, "w"}});
|
|
||||||
|
|
||||||
test_ignore_empty<T>(
|
|
||||||
{{1, 2, X::empty}, {3, 4, "y"}, {9, 10, "v"}, {11, 12, X::empty}});
|
|
||||||
|
|
||||||
test_ignore_empty<T>(
|
|
||||||
{{1, 2, "x"}, {3, 4, "y"}, {9, 10, X::empty}, {11, 12, X::empty}});
|
|
||||||
|
|
||||||
test_ignore_empty<T>(
|
|
||||||
{{1, 2, X::empty}, {3, 4, "y"}, {9, 10, X::empty}, {11, 12, X::empty}});
|
|
||||||
|
|
||||||
test_ignore_empty<T>({{1, 2, X::empty},
|
|
||||||
{3, 4, X::empty},
|
|
||||||
{9, 10, X::empty},
|
|
||||||
{11, 12, X::empty}});
|
|
||||||
|
|
||||||
test_ignore_empty<T>(
|
|
||||||
{{1, 2, "x"}, {3, 4, X::empty}, {9, 10, X::empty}, {11, 12, X::empty}});
|
|
||||||
|
|
||||||
test_ignore_empty<T>(
|
|
||||||
{{1, 2, X::empty}, {3, 4, X::empty}, {9, 10, X::empty}, {11, 12, "w"}});
|
|
||||||
|
|
||||||
test_ignore_empty<T>({{11, 12, X::empty}});
|
|
||||||
|
|
||||||
test_ignore_empty<T>({});
|
|
||||||
}
|
|
||||||
|
|||||||
301
test/test_parser1_5.cpp
Normal file
301
test/test_parser1_5.cpp
Normal file
@@ -0,0 +1,301 @@
|
|||||||
|
#include "test_parser1.hpp"
|
||||||
|
|
||||||
|
TEST_CASE_TEMPLATE("test empty fields header", T, ParserOptionCombinations) {
|
||||||
|
constexpr auto buffer_mode = T::BufferMode::value;
|
||||||
|
using ErrorMode = typename T::ErrorMode;
|
||||||
|
|
||||||
|
unique_file_name f{"empty_fields_header"};
|
||||||
|
|
||||||
|
// Empty header
|
||||||
|
{
|
||||||
|
std::ofstream out{f.name};
|
||||||
|
out << "" << std::endl;
|
||||||
|
out << "1" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::vector<std::string> expected_header = {""};
|
||||||
|
auto [p, _] = make_parser<buffer_mode, ErrorMode>(f.name);
|
||||||
|
CHECK_EQ_ARRAY(expected_header, p.header());
|
||||||
|
CHECK_EQ("", p.raw_header());
|
||||||
|
CHECK(p.valid());
|
||||||
|
}
|
||||||
|
|
||||||
|
// All empty header fields
|
||||||
|
{
|
||||||
|
std::ofstream out{f.name};
|
||||||
|
out << ",," << std::endl;
|
||||||
|
out << "1,2,3" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::vector<std::string> expected_header = {"", "", ""};
|
||||||
|
auto [p, _] = make_parser<buffer_mode, ErrorMode>(f.name);
|
||||||
|
CHECK_EQ_ARRAY(expected_header, p.header());
|
||||||
|
CHECK_EQ(",,", p.raw_header());
|
||||||
|
CHECK(p.valid());
|
||||||
|
|
||||||
|
auto command1 = [&p = p] { std::ignore = p.field_exists("Int"); };
|
||||||
|
expect_error_on_command(p, command1);
|
||||||
|
|
||||||
|
auto command2 = [&p = p] { p.use_fields("Int"); };
|
||||||
|
expect_error_on_command(p, command2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// One empty field
|
||||||
|
const std::vector<std::string> valid_fields = {"Int0", "Int1", ""};
|
||||||
|
|
||||||
|
using svec = std::vector<std::string>;
|
||||||
|
const std::vector<std::vector<std::string>> valid_field_combinations =
|
||||||
|
{svec{"Int0"},
|
||||||
|
svec{"Int1"},
|
||||||
|
svec{""},
|
||||||
|
svec{"", "Int0"},
|
||||||
|
svec{"Int0", "Int1"},
|
||||||
|
svec{"Int1", ""},
|
||||||
|
svec{"Int0", "", "Int1"},
|
||||||
|
svec{"", "Int1", "Int0"}};
|
||||||
|
|
||||||
|
// Last header field empty
|
||||||
|
{
|
||||||
|
std::ofstream out{f.name};
|
||||||
|
out << "Int0,Int1," << std::endl;
|
||||||
|
out << "1,2,3" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::vector<std::string> expected_header = {"Int0", "Int1", ""};
|
||||||
|
auto [p, _] = make_parser<buffer_mode, ErrorMode>(f.name);
|
||||||
|
CHECK_EQ_ARRAY(expected_header, p.header());
|
||||||
|
CHECK_EQ("Int0,Int1,", p.raw_header());
|
||||||
|
CHECK(p.valid());
|
||||||
|
|
||||||
|
for (const auto& field : valid_fields) {
|
||||||
|
CHECK(p.field_exists(field));
|
||||||
|
CHECK(p.valid());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& fields : valid_field_combinations) {
|
||||||
|
p.use_fields(fields);
|
||||||
|
CHECK(p.valid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// First header field empty
|
||||||
|
{
|
||||||
|
std::ofstream out{f.name};
|
||||||
|
out << ",Int0,Int1" << std::endl;
|
||||||
|
out << "1,2,3" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::vector<std::string> expected_header = {"", "Int0", "Int1"};
|
||||||
|
auto [p, _] = make_parser<buffer_mode, ErrorMode>(f.name);
|
||||||
|
CHECK_EQ_ARRAY(expected_header, p.header());
|
||||||
|
CHECK_EQ(",Int0,Int1", p.raw_header());
|
||||||
|
CHECK(p.valid());
|
||||||
|
|
||||||
|
for (const auto& field : valid_fields) {
|
||||||
|
CHECK(p.field_exists(field));
|
||||||
|
CHECK(p.valid());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& fields : valid_field_combinations) {
|
||||||
|
p.use_fields(fields);
|
||||||
|
CHECK(p.valid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Middle header field empty
|
||||||
|
{
|
||||||
|
std::ofstream out{f.name};
|
||||||
|
out << "Int0,,Int1" << std::endl;
|
||||||
|
out << "1,2,3" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
std::vector<std::string> expected_header = {"Int0", "", "Int1"};
|
||||||
|
auto [p, _] = make_parser<buffer_mode, ErrorMode>(f.name);
|
||||||
|
CHECK_EQ_ARRAY(expected_header, p.header());
|
||||||
|
CHECK_EQ("Int0,,Int1", p.raw_header());
|
||||||
|
CHECK(p.valid());
|
||||||
|
|
||||||
|
for (const auto& field : valid_fields) {
|
||||||
|
CHECK(p.field_exists(field));
|
||||||
|
CHECK(p.valid());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& fields : valid_field_combinations) {
|
||||||
|
p.use_fields(fields);
|
||||||
|
CHECK(p.valid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename... Ts>
|
||||||
|
void test_unterminated_quote_header() {
|
||||||
|
constexpr auto buffer_mode = T::BufferMode::value;
|
||||||
|
using ErrorMode = typename T::ErrorMode;
|
||||||
|
|
||||||
|
unique_file_name f{"unterminated_quote_header"};
|
||||||
|
|
||||||
|
{
|
||||||
|
std::ofstream out{f.name};
|
||||||
|
out << "\"Int" << std::endl;
|
||||||
|
out << "1" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto [p, _] = make_parser<buffer_mode, ErrorMode, Ts...>(f.name);
|
||||||
|
|
||||||
|
auto command0 = [&p = p] { std::ignore = p.header(); };
|
||||||
|
expect_error_on_command(p, command0);
|
||||||
|
CHECK_EQ(p.raw_header(), "\"Int");
|
||||||
|
|
||||||
|
auto command1 = [&p = p] { std::ignore = p.field_exists("Int"); };
|
||||||
|
expect_error_on_command(p, command1);
|
||||||
|
|
||||||
|
auto command2 = [&p = p] { p.use_fields("Int"); };
|
||||||
|
expect_error_on_command(p, command2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE_TEMPLATE("test unterminated quote header", T,
|
||||||
|
ParserOptionCombinations) {
|
||||||
|
using quote = ss::quote<'"'>;
|
||||||
|
using escape = ss::escape<'\\'>;
|
||||||
|
test_unterminated_quote_header<T, quote>();
|
||||||
|
test_unterminated_quote_header<T, quote, ss::multiline>();
|
||||||
|
test_unterminated_quote_header<T, quote, escape>();
|
||||||
|
test_unterminated_quote_header<T, quote, escape, ss::multiline>();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename... Ts>
|
||||||
|
void test_unterminated_escape_header() {
|
||||||
|
constexpr auto buffer_mode = T::BufferMode::value;
|
||||||
|
using ErrorMode = typename T::ErrorMode;
|
||||||
|
|
||||||
|
unique_file_name f{"unterminated_escape_header"};
|
||||||
|
|
||||||
|
// Unterminated escape in header
|
||||||
|
{
|
||||||
|
std::ofstream out{f.name};
|
||||||
|
out << "Int\\" << std::endl;
|
||||||
|
out << "1" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto [p, _] = make_parser<buffer_mode, ErrorMode, Ts...>(f.name);
|
||||||
|
|
||||||
|
auto command0 = [&p = p] { std::ignore = p.header(); };
|
||||||
|
expect_error_on_command(p, command0);
|
||||||
|
CHECK_EQ(p.raw_header(), "Int\\");
|
||||||
|
|
||||||
|
auto command1 = [&p = p] { std::ignore = p.field_exists("Int"); };
|
||||||
|
expect_error_on_command(p, command1);
|
||||||
|
|
||||||
|
auto command2 = [&p = p] { p.use_fields("Int"); };
|
||||||
|
expect_error_on_command(p, command2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE_TEMPLATE("test unterminated escape header", T,
|
||||||
|
ParserOptionCombinations) {
|
||||||
|
using quote = ss::quote<'"'>;
|
||||||
|
using escape = ss::escape<'\\'>;
|
||||||
|
test_unterminated_escape_header<T, escape>();
|
||||||
|
test_unterminated_escape_header<T, escape, ss::multiline>();
|
||||||
|
test_unterminated_escape_header<T, escape, quote>();
|
||||||
|
test_unterminated_escape_header<T, escape, quote, ss::multiline>();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void test_ignore_empty(const std::vector<X>& data) {
|
||||||
|
constexpr auto buffer_mode = T::BufferMode::value;
|
||||||
|
using ErrorMode = typename T::ErrorMode;
|
||||||
|
|
||||||
|
unique_file_name f{"ignore_empty"};
|
||||||
|
make_and_write(f.name, data);
|
||||||
|
|
||||||
|
std::vector<X> expected;
|
||||||
|
for (const auto& d : data) {
|
||||||
|
if (d.s != X::empty) {
|
||||||
|
expected.push_back(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto [p, _] =
|
||||||
|
make_parser<buffer_mode, ErrorMode, ss::ignore_empty>(f.name, ",");
|
||||||
|
|
||||||
|
std::vector<X> i;
|
||||||
|
for (const auto& a : p.template iterate<X>()) {
|
||||||
|
i.push_back(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
CHECK_EQ(i, expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto [p, _] = make_parser<buffer_mode, ErrorMode>(f.name, ",");
|
||||||
|
std::vector<X> i;
|
||||||
|
size_t n = 0;
|
||||||
|
while (!p.eof()) {
|
||||||
|
try {
|
||||||
|
++n;
|
||||||
|
const auto& a = p.template get_next<X>();
|
||||||
|
if (data.at(n - 1).s == X::empty) {
|
||||||
|
CHECK_FALSE(p.valid());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
i.push_back(a);
|
||||||
|
} catch (...) {
|
||||||
|
CHECK_EQ(data.at(n - 1).s, X::empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CHECK_EQ(i, expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE_TEMPLATE("test various cases with empty lines", T,
|
||||||
|
ParserOptionCombinations) {
|
||||||
|
test_ignore_empty<T>(
|
||||||
|
{{1, 2, "x"}, {3, 4, "y"}, {9, 10, "v"}, {11, 12, "w"}});
|
||||||
|
|
||||||
|
test_ignore_empty<T>(
|
||||||
|
{{1, 2, X::empty}, {3, 4, "y"}, {9, 10, "v"}, {11, 12, "w"}});
|
||||||
|
|
||||||
|
test_ignore_empty<T>(
|
||||||
|
{{1, 2, "x"}, {3, 4, "y"}, {9, 10, "v"}, {11, 12, X::empty}});
|
||||||
|
|
||||||
|
test_ignore_empty<T>(
|
||||||
|
{{1, 2, "x"}, {5, 6, X::empty}, {9, 10, "v"}, {11, 12, "w"}});
|
||||||
|
|
||||||
|
test_ignore_empty<T>(
|
||||||
|
{{1, 2, X::empty}, {5, 6, X::empty}, {9, 10, "v"}, {11, 12, "w"}});
|
||||||
|
|
||||||
|
test_ignore_empty<T>(
|
||||||
|
{{1, 2, X::empty}, {3, 4, "y"}, {9, 10, "v"}, {11, 12, X::empty}});
|
||||||
|
|
||||||
|
test_ignore_empty<T>(
|
||||||
|
{{1, 2, "x"}, {3, 4, "y"}, {9, 10, X::empty}, {11, 12, X::empty}});
|
||||||
|
|
||||||
|
test_ignore_empty<T>(
|
||||||
|
{{1, 2, X::empty}, {3, 4, "y"}, {9, 10, X::empty}, {11, 12, X::empty}});
|
||||||
|
|
||||||
|
test_ignore_empty<T>({{1, 2, X::empty},
|
||||||
|
{3, 4, X::empty},
|
||||||
|
{9, 10, X::empty},
|
||||||
|
{11, 12, X::empty}});
|
||||||
|
|
||||||
|
test_ignore_empty<T>(
|
||||||
|
{{1, 2, "x"}, {3, 4, X::empty}, {9, 10, X::empty}, {11, 12, X::empty}});
|
||||||
|
|
||||||
|
test_ignore_empty<T>(
|
||||||
|
{{1, 2, X::empty}, {3, 4, X::empty}, {9, 10, X::empty}, {11, 12, "w"}});
|
||||||
|
|
||||||
|
test_ignore_empty<T>({{11, 12, X::empty}});
|
||||||
|
|
||||||
|
test_ignore_empty<T>({});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user