Add extended tests with no new line at eof

This commit is contained in:
ado
2024-02-22 00:30:05 +01:00
parent 57ba23c574
commit 3ea8adedfd
4 changed files with 43 additions and 41 deletions

View File

@@ -12,7 +12,7 @@ using string_range = std::pair<const char*, const char*>;
using split_data = std::vector<string_range>;
constexpr inline auto default_delimiter = ",";
constexpr static auto get_line_initial_buffer_size = 128;
constexpr inline auto get_line_initial_buffer_size = 128;
template <bool StringError>
inline void assert_string_error_defined() {
@@ -31,7 +31,7 @@ inline ssize_t get_line_file(char** lineptr, size_t* n, FILE* stream) {
return getline(lineptr, n, stream);
}
#else
// TODO set ERRNO ?
using ssize_t = int64_t;
inline ssize_t get_line_file(char** lineptr, size_t* n, FILE* stream) {
size_t pos;

View File

@@ -5,6 +5,7 @@
#include "exception.hpp"
#include "extract.hpp"
#include "restrictions.hpp"
#include <cerrno>
#include <cstdlib>
#include <cstring>
#include <optional>
@@ -742,7 +743,6 @@ private:
reader(const reader& other) = delete;
reader& operator=(const reader& other) = delete;
// TODO set error numbers on error
ssize_t get_line_buffer(char** lineptr, size_t* n,
const char* const buffer, size_t csv_data_size,
size_t& curr_char) {
@@ -812,6 +812,9 @@ private:
}
if (ssize == -1) {
if (errno == ENOMEM) {
throw std::bad_alloc{};
}
return false;
}