mirror of
				https://github.com/red0124/ssp.git
				synced 2025-11-03 22:36:44 +01:00 
			
		
		
		
	[skip ci] Fix line method
This commit is contained in:
		
							parent
							
								
									88e711a5f7
								
							
						
					
					
						commit
						05f87bc78b
					
				@ -102,7 +102,7 @@ public:
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    size_t line() const {
 | 
					    size_t line() const {
 | 
				
			||||||
        return reader_.line_number_ > 1 ? reader_.line_number_ - 1
 | 
					        return reader_.line_number_ > 0 ? reader_.line_number_ - 1
 | 
				
			||||||
                                        : reader_.line_number_;
 | 
					                                        : reader_.line_number_;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -697,8 +697,7 @@ private:
 | 
				
			|||||||
              csv_data_buffer_{other.csv_data_buffer_},
 | 
					              csv_data_buffer_{other.csv_data_buffer_},
 | 
				
			||||||
              csv_data_size_{other.csv_data_size_},
 | 
					              csv_data_size_{other.csv_data_size_},
 | 
				
			||||||
              curr_char_{other.curr_char_}, crlf_{other.crlf_},
 | 
					              curr_char_{other.curr_char_}, crlf_{other.crlf_},
 | 
				
			||||||
              line_number_{other.line_number_},
 | 
					              line_number_{other.line_number_}, chars_read_{other.chars_read_},
 | 
				
			||||||
              chars_read_{other.chars_read_},
 | 
					 | 
				
			||||||
              next_line_size_{other.next_line_size_} {
 | 
					              next_line_size_{other.next_line_size_} {
 | 
				
			||||||
            other.buffer_ = nullptr;
 | 
					            other.buffer_ = nullptr;
 | 
				
			||||||
            other.next_line_buffer_ = nullptr;
 | 
					            other.next_line_buffer_ = nullptr;
 | 
				
			||||||
 | 
				
			|||||||
@ -78,8 +78,8 @@ struct unique_file_name {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    unique_file_name(const std::string& test) {
 | 
					    unique_file_name(const std::string& test) {
 | 
				
			||||||
        do {
 | 
					        do {
 | 
				
			||||||
            name = "random_" + test + "_" + std::to_string(i++) + "_" +
 | 
					            name = "random_file_test_" + test + "_" + std::to_string(i++) +
 | 
				
			||||||
                   time_now_rand() + "_file.csv";
 | 
					                   "_" + time_now_rand() + "_file.csv";
 | 
				
			||||||
        } while (std::filesystem::exists(name));
 | 
					        } while (std::filesystem::exists(name));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -99,17 +99,17 @@ TEST_CASE_TEMPLATE("test position method", T, ParserOptionCombinations) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO uncomment
 | 
					TEST_CASE_TEMPLATE("test line method", T, ParserOptionCombinations) {
 | 
				
			||||||
/*
 | 
					    constexpr auto buffer_mode = T::BufferMode::value;
 | 
				
			||||||
TEST_CASE_TEMPLATE("test line method", BufferMode, std::true_type,
 | 
					    using ErrorMode = typename T::ErrorMode;
 | 
				
			||||||
                   std::false_type) {
 | 
					
 | 
				
			||||||
    unique_file_name f{"test_parser"};
 | 
					    unique_file_name f{"line_method"};
 | 
				
			||||||
    std::vector<Y> data = {{"1", "21", "x"},   {"321", "4", "y"},
 | 
					    std::vector<Y> data = {{"1", "21", "x"},   {"321", "4", "y"},
 | 
				
			||||||
                           {"54", "6", "zz"},  {"7", "876", "uuuu"},
 | 
					                           {"54", "6", "zz"},  {"7", "876", "uuuu"},
 | 
				
			||||||
                           {"910", "10", "v"}, {"10", "321", "ww"}};
 | 
					                           {"910", "10", "v"}, {"10", "321", "ww"}};
 | 
				
			||||||
    make_and_write(f.name, data);
 | 
					    make_and_write(f.name, data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    auto [p, buff] = make_parser<BufferMode::value>(f.name);
 | 
					    auto [p, buff] = make_parser<buffer_mode, ErrorMode>(f.name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    auto expected_line = 0;
 | 
					    auto expected_line = 0;
 | 
				
			||||||
    CHECK_EQ(p.line(), expected_line);
 | 
					    CHECK_EQ(p.line(), expected_line);
 | 
				
			||||||
@ -122,7 +122,6 @@ TEST_CASE_TEMPLATE("test line method", BufferMode, std::true_type,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    CHECK_EQ(p.line(), data.size());
 | 
					    CHECK_EQ(p.line(), data.size());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
*/
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST_CASE_TEMPLATE("parser test various valid cases", T,
 | 
					TEST_CASE_TEMPLATE("parser test various valid cases", T,
 | 
				
			||||||
                   ParserOptionCombinations) {
 | 
					                   ParserOptionCombinations) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user