diff options
author | Kenneth Heafield <github@kheafield.com> | 2020-03-04 23:20:59 +0300 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2020-03-04 23:20:59 +0300 |
commit | cb1e96c069083507da1278d85ddd890ae15304c8 (patch) | |
tree | 05327cf89aee7492c4c9689c38477dc3c50505c8 | |
parent | aa174e619583552dcbd9690af961e11ab75c24e2 (diff) |
Get at least the PrepareA tests working
-rw-r--r-- | test/test.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/test.h b/test/test.h index a1ca724..ac4a8f6 100644 --- a/test/test.h +++ b/test/test.h @@ -38,7 +38,9 @@ template <typename Type> void CompareEps(const Type* reference, const Type* actual, Index size, Type epsilon) { for (Index i = 0; i < size; ++i) { INFO("Inaccurate at " << i << ' ' << reference[i] << ' ' << actual[i]); - CHECK(fabs(reference[i] - actual[i]) < epsilon); + // Ratio to maximum value. + float threshold = epsilon * std::max(0.01f, fabs(reference[i])); + CHECK(fabs(reference[i] - actual[i]) < threshold); } } |