| 270 | } |
| 271 | |
| 272 | bool FuzzyStringComparator::compareLines_(std::string const& line_str_1, std::string const& line_str_2) |
| 273 | { |
| 274 | // in most cases, results will be identical. If not, do the expensive fuzzy compare |
| 275 | if (line_str_1 == line_str_2) |
| 276 | { |
| 277 | return true; |
| 278 | } |
| 279 | for (StringList::const_iterator slit = whitelist_.begin(); |
| 280 | slit != whitelist_.end(); ++slit) |
| 281 | { |
| 282 | if (line_str_1.find(*slit) != String::npos && |
| 283 | line_str_2.find(*slit) != String::npos) |
| 284 | { |
| 285 | ++whitelist_cases_[*slit]; |
| 286 | // *log_dest_ << "whitelist_ case: " << *slit << '\n'; |
| 287 | return is_status_success_; |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | // check matched whitelist |
| 292 | // If file 1 contains element 1 and file 2 contains element 2, they are skipped over. |
| 293 | for (std::vector< std::pair<std::string, std::string> >::const_iterator pair_it = matched_whitelist_.begin(); |
| 294 | pair_it != matched_whitelist_.end(); ++pair_it) |
| 295 | { |
| 296 | if ((line_str_1.find(pair_it->first) != String::npos && |
| 297 | line_str_2.find(pair_it->second) != String::npos |
| 298 | ) || |
| 299 | (line_str_1.find(pair_it->second) != String::npos && |
| 300 | line_str_2.find(pair_it->first) != String::npos |
| 301 | ) |
| 302 | ) |
| 303 | { |
| 304 | // ++whitelist_cases_[*slit]; |
| 305 | // *log_dest_ << "whitelist_ case: " << *slit << '\n'; |
| 306 | return is_status_success_; |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | input_line_1_.setToString(line_str_1); |
| 311 | input_line_2_.setToString(line_str_2); |
| 312 | |
| 313 | try |
| 314 | { |
| 315 | while (input_line_1_.ok() && input_line_2_.ok()) |
| 316 | { |
| 317 | element_1_.fillFromInputLine(input_line_1_, line_str_1); |
| 318 | element_2_.fillFromInputLine(input_line_2_, line_str_2); |
| 319 | |
| 320 | if (element_1_.is_number) |
| 321 | { |
| 322 | if (element_2_.is_number) // we are comparing numbers |
| 323 | { |
| 324 | #ifdef DEBUG_FUZZY |
| 325 | std::cout << "cmp number: " << String(element_1_.number) << " : " << String(element_2_.number) << std::endl; |
| 326 | #endif |
| 327 | if (element_1_.number == element_2_.number) |
| 328 | { |
| 329 | continue; |
nothing calls this directly
no test coverage detected