Skip to content

Commit

Permalink
Fix #142 & update single header csv.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentlaucsb committed Dec 20, 2020
1 parent d55f20b commit 65dae06
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/internal/csv_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace csv {
size_t decimal = (size_t)(((double)std::abs(value) - (double)integral) * 100000);

result += ".";
result += (decimal == 0) ? "0" : to_string(integral);
result += (decimal == 0) ? "0" : to_string(decimal);

return result;
}
Expand Down
4 changes: 2 additions & 2 deletions single_include/csv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6556,7 +6556,7 @@ namespace csv {
size_t decimal = (size_t)(((double)std::abs(value) - (double)integral) * 100000);

result += ".";
result += (decimal == 0) ? "0" : to_string(integral);
result += (decimal == 0) ? "0" : to_string(decimal);

return result;
}
Expand Down Expand Up @@ -7307,7 +7307,7 @@ namespace csv {
* \snippet tests/test_read_csv.cpp CSVField Example
*
*/
CSV_INLINE CSVReader::CSVReader(csv::string_view filename, CSVFormat format) {
CSV_INLINE CSVReader::CSVReader(csv::string_view filename, CSVFormat format) : _format(format) {
auto head = internals::get_csv_head(filename);
using Parser = internals::MmapParser;

Expand Down
4 changes: 2 additions & 2 deletions single_include_test/csv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6556,7 +6556,7 @@ namespace csv {
size_t decimal = (size_t)(((double)std::abs(value) - (double)integral) * 100000);

result += ".";
result += (decimal == 0) ? "0" : to_string(integral);
result += (decimal == 0) ? "0" : to_string(decimal);

return result;
}
Expand Down Expand Up @@ -7307,7 +7307,7 @@ namespace csv {
* \snippet tests/test_read_csv.cpp CSVField Example
*
*/
CSV_INLINE CSVReader::CSVReader(csv::string_view filename, CSVFormat format) {
CSV_INLINE CSVReader::CSVReader(csv::string_view filename, CSVFormat format) : _format(format) {
auto head = internals::get_csv_head(filename);
using Parser = internals::MmapParser;

Expand Down
4 changes: 2 additions & 2 deletions tests/test_write_csv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ TEST_CASE("CSV Tuple", "[test_csv_tuple]") {
csv_writer << std::make_tuple("One", 2, "Three", 4.0, time)
<< std::make_tuple("One", (short)2, "Three", 4.0f, time)
<< std::make_tuple(-1, -2.0)
<< std::make_tuple(20.2, -20.2)
<< std::make_tuple(20.2, -20.3)
<< std::make_tuple(0.0, 0.0f, 0);

correct_output << "One,2,Three,4.0,5:30" << std::endl
<< "One,2,Three,4.0,5:30" << std::endl
<< "-1,-2.0" << std::endl
<< "20.20,-20.20" << std::endl
<< "20.19999,-20.30000" << std::endl
<< "0.0,0.0,0" << std::endl;

REQUIRE(output.str() == correct_output.str());
Expand Down

0 comments on commit 65dae06

Please sign in to comment.