From 6106a4de410e7cc59515dd889e159bee7aa45d35 Mon Sep 17 00:00:00 2001 From: Moritz Pflanzer Date: Wed, 2 Aug 2017 09:42:27 +0100 Subject: COMPMID-415: Use absolute and relative tolerance Change-Id: Ib779fa307e05fa67172ddaf521239b4c746debc8 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/82229 Reviewed-by: Anthony Barbier Tested-by: Kaizen --- tests/validation_new/Validation.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'tests/validation_new/Validation.cpp') diff --git a/tests/validation_new/Validation.cpp b/tests/validation_new/Validation.cpp index a492bb6505..fec7c10939 100644 --- a/tests/validation_new/Validation.cpp +++ b/tests/validation_new/Validation.cpp @@ -128,17 +128,16 @@ void check_border_element(const IAccessor &tensor, const Coordinates &id, { const size_t channel_offset = channel * channel_size; const double target = get_double_data(ptr + channel_offset, tensor.data_type()); - const double ref = get_double_data(static_cast(border_value) + channel_offset, tensor.data_type()); - const bool equal = is_equal(target, ref); + const double reference = get_double_data(static_cast(border_value) + channel_offset, tensor.data_type()); - ARM_COMPUTE_TEST_INFO("id = " << id); - ARM_COMPUTE_TEST_INFO("channel = " << channel); - ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << target); - ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << ref); - ARM_COMPUTE_EXPECT_EQUAL(target, ref, framework::LogLevel::DEBUG); - - if(!equal) + if(!compare, double>(target, reference)) { + ARM_COMPUTE_TEST_INFO("id = " << id); + ARM_COMPUTE_TEST_INFO("channel = " << channel); + ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << target); + ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << reference); + ARM_COMPUTE_EXPECT_EQUAL(target, reference, framework::LogLevel::DEBUG); + ++num_mismatches; } @@ -191,17 +190,16 @@ void validate(const IAccessor &tensor, const void *reference_value) { const size_t channel_offset = channel * channel_size; const double target = get_double_data(ptr + channel_offset, tensor.data_type()); - const double ref = get_double_data(reference_value, tensor.data_type()); - const bool equal = is_equal(target, ref); + const double reference = get_double_data(reference_value, tensor.data_type()); - ARM_COMPUTE_TEST_INFO("id = " << id); - ARM_COMPUTE_TEST_INFO("channel = " << channel); - ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << target); - ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << ref); - ARM_COMPUTE_EXPECT_EQUAL(target, ref, framework::LogLevel::DEBUG); - - if(!equal) + if(!compare, double>(target, reference)) { + ARM_COMPUTE_TEST_INFO("id = " << id); + ARM_COMPUTE_TEST_INFO("channel = " << channel); + ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << target); + ARM_COMPUTE_TEST_INFO("reference = " << std::setprecision(5) << reference); + ARM_COMPUTE_EXPECT_EQUAL(target, reference, framework::LogLevel::DEBUG); + ++num_mismatches; } -- cgit v1.2.1