Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Commit

Permalink
Report maximum diff (#1109)
Browse files Browse the repository at this point in the history
  • Loading branch information
primenumber authored Jun 22, 2020
1 parent dbb810c commit 0d22ed4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions blueoil/converter/templates/include/dlk_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,15 @@ namespace dlk_test
int failed_index = -1;

std::vector<Diff<T_SIZE,T_IN> > diff_array;
T_IN max_diff = 0;

for (T_SIZE i = 0; i < num_elems; i++)
{
T_IN diff;
if (!same(input[i], result_array[i], diff)) {
if (failed_index == -1) { failed_index = i; }
++failed_count;
max_diff = std::max(max_diff, diff);
Diff<T_SIZE, T_IN> d(i, input[i], T_IN(result_array[i]), diff);
diff_array.push_back(d);
}
Expand All @@ -119,6 +121,7 @@ namespace dlk_test

std::cout << "Comparison: " << result_name << " failed..." << "\n"
<< "Failed count: " << failed_count << "\n"
<< "Maximum diff: " << max_diff << "\n"
<< "First failed report" << "\n"
<< "index: " << failed_index << " / " << num_elems << "\n"
<< "input: " << s_index.str() << ", "
Expand Down

0 comments on commit 0d22ed4

Please sign in to comment.