mirror of
https://github.com/red0124/ssp.git
synced 2026-01-29 22:29:54 +01:00
add splitter tests
This commit is contained in:
@@ -1,20 +1,18 @@
|
||||
#include "test_helpers.hpp"
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <ss/parser.hpp>
|
||||
|
||||
#ifdef CMAKE_GITHUB_CI
|
||||
#include <doctest/doctest.h>
|
||||
#else
|
||||
#include <doctest.h>
|
||||
#endif
|
||||
|
||||
struct unique_file_name {
|
||||
const std::string name;
|
||||
|
||||
unique_file_name() : name{std::tmpnam(nullptr)} {}
|
||||
unique_file_name() : name{std::tmpnam(nullptr)} {
|
||||
}
|
||||
|
||||
~unique_file_name() { std::filesystem::remove(name); }
|
||||
~unique_file_name() {
|
||||
std::filesystem::remove(name);
|
||||
}
|
||||
};
|
||||
|
||||
struct X {
|
||||
@@ -30,7 +28,9 @@ struct X {
|
||||
.append(delim)
|
||||
.append(s);
|
||||
}
|
||||
auto tied() const { return std::tie(i, d, s); }
|
||||
auto tied() const {
|
||||
return std::tie(i, d, s);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@@ -167,10 +167,13 @@ struct test_struct {
|
||||
int i;
|
||||
double d;
|
||||
char c;
|
||||
auto tied() { return std::tie(i, d, c); }
|
||||
auto tied() {
|
||||
return std::tie(i, d, c);
|
||||
}
|
||||
};
|
||||
|
||||
void expect_test_struct(const test_struct&) {}
|
||||
void expect_test_struct(const test_struct&) {
|
||||
}
|
||||
|
||||
// various scenarios
|
||||
TEST_CASE("testing composite conversion") {
|
||||
@@ -392,7 +395,9 @@ struct my_string {
|
||||
|
||||
my_string() = default;
|
||||
|
||||
~my_string() { delete[] data; }
|
||||
~my_string() {
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
// make sure no object is copied
|
||||
my_string(const my_string&) = delete;
|
||||
@@ -423,7 +428,9 @@ struct xyz {
|
||||
my_string x;
|
||||
my_string y;
|
||||
my_string z;
|
||||
auto tied() { return std::tie(x, y, z); }
|
||||
auto tied() {
|
||||
return std::tie(x, y, z);
|
||||
}
|
||||
};
|
||||
|
||||
TEST_CASE("testing the moving of parsed values") {
|
||||
|
||||
Reference in New Issue
Block a user