Add test case with valid junk.
Use eps to explicitly match empty string and not consume input
This commit is contained in:
parent
40b5045a0a
commit
acb7916996
@ -402,8 +402,8 @@ Feature: Weight tests
|
|||||||
And the speed file
|
And the speed file
|
||||||
"""
|
"""
|
||||||
1,2,100,
|
1,2,100,
|
||||||
1,3,5,
|
1,3,5,,junk
|
||||||
3,4,5,
|
3,4,5,,
|
||||||
4,2,5,
|
4,2,5,
|
||||||
"""
|
"""
|
||||||
And the contract extra arguments "--segment-speed-file {speeds_file}"
|
And the contract extra arguments "--segment-speed-file {speeds_file}"
|
||||||
|
@ -33,10 +33,11 @@ namespace csv
|
|||||||
{
|
{
|
||||||
SegmentLookupTable readSegmentValues(const std::vector<std::string> &paths)
|
SegmentLookupTable readSegmentValues(const std::vector<std::string> &paths)
|
||||||
{
|
{
|
||||||
|
static const auto value_if_blank = std::numeric_limits<double>::quiet_NaN();
|
||||||
CSVFilesParser<Segment, SpeedSource> parser(
|
CSVFilesParser<Segment, SpeedSource> parser(
|
||||||
1,
|
1,
|
||||||
qi::ulong_long >> ',' >> qi::ulong_long,
|
qi::ulong_long >> ',' >> qi::ulong_long,
|
||||||
qi::uint_ >> -(',' >> (qi::double_ | qi::attr(std::numeric_limits<double>::quiet_NaN()))));
|
qi::uint_ >> -(',' >> (qi::double_ | qi::attr(value_if_blank))));
|
||||||
|
|
||||||
// Check consistency of keys in the result lookup table
|
// Check consistency of keys in the result lookup table
|
||||||
auto result = parser(paths);
|
auto result = parser(paths);
|
||||||
|
Loading…
Reference in New Issue
Block a user