diff options
author | steniu01 <steven.niu@arm.com> | 2017-06-22 10:20:37 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-09-17 14:14:20 +0100 |
commit | 423d88fb7e35333cd243fbe04a8558fd5ac1489f (patch) | |
tree | dbe88966905f42fcd15591a28fdc8a914d37cf51 /tests/validation | |
parent | 4cbee6e66f4425a3ab5bfac3bbf400e6818a224d (diff) | |
download | ComputeLibrary-423d88fb7e35333cd243fbe04a8558fd5ac1489f.tar.gz |
COMPMID-250 handle single float comparision
Change-Id: I0007dfba16952d427e73185d9c971e79e9f612c9
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/78507
Reviewed-by: Moritz Pflanzer <moritz.pflanzer@arm.com>
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'tests/validation')
-rw-r--r-- | tests/validation/NEON/MeanStdDev.cpp | 8 | ||||
-rw-r--r-- | tests/validation/Validation.cpp | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/tests/validation/NEON/MeanStdDev.cpp b/tests/validation/NEON/MeanStdDev.cpp index 4cb04455ec..4804354551 100644 --- a/tests/validation/NEON/MeanStdDev.cpp +++ b/tests/validation/NEON/MeanStdDev.cpp @@ -123,8 +123,8 @@ BOOST_DATA_TEST_CASE(RunSmall, Small2DShapes(), shape) std::pair<float, float> ref_output = Reference::compute_reference_mean_and_standard_deviation(shape); // Validate output - BOOST_TEST(static_cast<int>(output.first) == static_cast<int>(ref_output.first)); - BOOST_TEST(static_cast<int>(output.second) == static_cast<int>(ref_output.second)); + validate(output.first, ref_output.first); + validate(output.second, ref_output.second); } BOOST_TEST_DECORATOR(*boost::unit_test::label("nightly")) @@ -137,8 +137,8 @@ BOOST_DATA_TEST_CASE(RunLarge, Large2DShapes(), shape) std::pair<float, float> ref_output = Reference::compute_reference_mean_and_standard_deviation(shape); // Validate output - BOOST_TEST(static_cast<int>(output.first) == static_cast<int>(ref_output.first)); - BOOST_TEST(static_cast<int>(output.second) == static_cast<int>(ref_output.second)); + validate(output.first, ref_output.first); + validate(output.second, ref_output.second); } BOOST_AUTO_TEST_SUITE_END() diff --git a/tests/validation/Validation.cpp b/tests/validation/Validation.cpp index c1c43c05c4..89f91c0dd9 100644 --- a/tests/validation/Validation.cpp +++ b/tests/validation/Validation.cpp @@ -392,6 +392,16 @@ void validate(std::vector<unsigned int> classified_labels, std::vector<unsigned BOOST_TEST(classified_labels[i] == expected_labels[i]); } } + +void validate(float target, float ref, float tolerance_abs_error = std::numeric_limits<float>::epsilon(), float tolerance_relative_error = 0.0001f) +{ + const bool equal = is_equal(target, ref, tolerance_abs_error, tolerance_relative_error); + + BOOST_TEST_INFO("reference = " << std::setprecision(5) << ref); + BOOST_TEST_INFO("target = " << std::setprecision(5) << target); + BOOST_TEST(equal); +} + } // namespace validation } // namespace test } // namespace arm_compute |