aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/Validation.h
diff options
context:
space:
mode:
authorJohn Richardson <john.richardson@arm.com>2017-09-05 11:21:56 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commitf89a49f7bdd8d03400060488596c8757745e19cf (patch)
tree7e98eb703794e2bce9b9f2fbcbfc9c29714cf8fe /tests/validation/Validation.h
parentf3aeee133c1c9c98c6828e935cf4f9801fbda9e1 (diff)
downloadComputeLibrary-f89a49f7bdd8d03400060488596c8757745e19cf.tar.gz
COMPMID-503: Move MinMaxLocation to new validation
Change-Id: I2d518b3a3f15e2c4786488593dac244c1d74a0f9 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/86533 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Moritz Pflanzer <moritz.pflanzer@arm.com>
Diffstat (limited to 'tests/validation/Validation.h')
-rw-r--r--tests/validation/Validation.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/validation/Validation.h b/tests/validation/Validation.h
index 38cbadaa9b..60461f3579 100644
--- a/tests/validation/Validation.h
+++ b/tests/validation/Validation.h
@@ -28,6 +28,7 @@
#include "arm_compute/core/Types.h"
#include "tests/IAccessor.h"
#include "tests/SimpleTensor.h"
+#include "tests/Types.h"
#include "tests/Utils.h"
#include "tests/framework/Asserts.h"
#include "tests/framework/Exceptions.h"
@@ -365,6 +366,37 @@ void validate(T target, T reference, U tolerance)
ARM_COMPUTE_TEST_INFO("tolerance = " << std::setprecision(5) << framework::make_printable(static_cast<typename U::value_type>(tolerance)));
ARM_COMPUTE_EXPECT((compare<U>(target, reference, tolerance)), framework::LogLevel::ERRORS);
}
+
+template <typename T, typename U>
+void validate_min_max_loc(const MinMaxLocationValues<T> &target, const MinMaxLocationValues<U> &reference)
+{
+ ARM_COMPUTE_EXPECT_EQUAL(target.min, reference.min, framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT_EQUAL(target.max, reference.max, framework::LogLevel::ERRORS);
+
+ ARM_COMPUTE_EXPECT_EQUAL(target.min_loc.size(), reference.min_loc.size(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT_EQUAL(target.max_loc.size(), reference.max_loc.size(), framework::LogLevel::ERRORS);
+
+ for(uint32_t i = 0; i < target.min_loc.size(); ++i)
+ {
+ const auto same_coords = std::find_if(reference.min_loc.begin(), reference.min_loc.end(), [&target, i](Coordinates2D coord)
+ {
+ return coord.x == target.min_loc.at(i).x && coord.y == target.min_loc.at(i).y;
+ });
+
+ ARM_COMPUTE_EXPECT(same_coords != reference.min_loc.end(), framework::LogLevel::ERRORS);
+ }
+
+ for(uint32_t i = 0; i < target.max_loc.size(); ++i)
+ {
+ const auto same_coords = std::find_if(reference.max_loc.begin(), reference.max_loc.end(), [&target, i](Coordinates2D coord)
+ {
+ return coord.x == target.max_loc.at(i).x && coord.y == target.max_loc.at(i).y;
+ });
+
+ ARM_COMPUTE_EXPECT(same_coords != reference.max_loc.end(), framework::LogLevel::ERRORS);
+ }
+}
+
} // namespace validation
} // namespace test
} // namespace arm_compute