Skip to content

Commit

Permalink
ignore missing calcChain when comparing xlsx files during testing
Browse files Browse the repository at this point in the history
  • Loading branch information
tfussell committed May 8, 2017
1 parent 7ddd290 commit 237fdcc
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tests/helpers/xml_helper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,27 @@ class xml_helper

const auto right_info = right_archive.files();

if (left_info.size() != right_info.size())
auto difference_is_missing_calc_chain = false;

if (std::abs(int(left_info.size()) - int(right_info.size())) == 1)
{
auto is_calc_chain = [](const xlnt::path &p)
{
return p.filename() == "calcChain.xml";
};

auto left_has_calc_chain = std::find_if(left_info.begin(), left_info.end(), is_calc_chain)
!= left_info.end();
auto right_has_calc_chain = std::find_if(right_info.begin(), right_info.end(), is_calc_chain)
!= right_info.end();

if (left_has_calc_chain != right_has_calc_chain)
{
difference_is_missing_calc_chain = true;
}
}

if (left_info.size() != right_info.size() && ! difference_is_missing_calc_chain)
{
std::cout << "left has a different number of files than right" << std::endl;

Expand Down Expand Up @@ -198,8 +218,14 @@ class xml_helper
{
if (!right_archive.has_file(left_member))
{
if (difference_is_missing_calc_chain)
{
continue;
}

match = false;
std::cout << "right is missing file: " << left_member.string() << std::endl;

break;
}

Expand Down

0 comments on commit 237fdcc

Please sign in to comment.