aboutsummaryrefslogtreecommitdiff
path: root/src/armnnUtils/test/QuantizeHelperTest.cpp
diff options
context:
space:
mode:
authorAron Virginas-Tar <Aron.Virginas-Tar@arm.com>2019-10-22 10:00:28 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-10-25 15:01:24 +0000
commit48623a0f6f4681ce0d9525b1587b7f96bfd58519 (patch)
treef5dbf25937e7b6641274e0953d09ca84acb51772 /src/armnnUtils/test/QuantizeHelperTest.cpp
parentc82c8732fb514b412012002bd951a84039eca696 (diff)
downloadarmnn-48623a0f6f4681ce0d9525b1587b7f96bfd58519.tar.gz
IVGCVSW-4018 Move QuantizeHelper.hpp to armnnUtils
* Moved QuntizeHelper.hpp to armnnUtils * Reordered parameters for QuantizedVector and added default values for qScale and qOffset to make life easier when using the function for non-quantized types such as Float16 Signed-off-by: Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> Change-Id: I28c263dfa425f1316feccb4116839a84f5d568e5
Diffstat (limited to 'src/armnnUtils/test/QuantizeHelperTest.cpp')
-rw-r--r--src/armnnUtils/test/QuantizeHelperTest.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/armnnUtils/test/QuantizeHelperTest.cpp b/src/armnnUtils/test/QuantizeHelperTest.cpp
new file mode 100644
index 0000000000..7e781d0b5d
--- /dev/null
+++ b/src/armnnUtils/test/QuantizeHelperTest.cpp
@@ -0,0 +1,46 @@
+//
+// Copyright © 2019 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+
+#include <QuantizeHelper.hpp>
+
+#include <boost/core/ignore_unused.hpp>
+#include <boost/test/unit_test.hpp>
+
+#include <vector>
+
+BOOST_AUTO_TEST_SUITE(QuantizeHelper)
+
+namespace
+{
+
+template<typename T>
+bool IsFloatIterFunc(T iter)
+{
+ boost::ignore_unused(iter);
+ return armnnUtils::IsFloatingPointIterator<T>::value;
+}
+
+} // anonymous namespace
+
+BOOST_AUTO_TEST_CASE(IsFloatIterFuncTest)
+{
+ std::vector<float> fArray;
+ BOOST_TEST(IsFloatIterFunc(fArray.begin()) == true);
+ BOOST_TEST(IsFloatIterFunc(fArray.cbegin()) == true);
+
+ std::vector<double> dArray;
+ BOOST_TEST(IsFloatIterFunc(dArray.begin()) == true);
+
+ std::vector<int> iArray;
+ BOOST_TEST(IsFloatIterFunc(iArray.begin()) == false);
+
+ float floats[5];
+ BOOST_TEST(IsFloatIterFunc(&floats[0]) == true);
+
+ int ints[5];
+ BOOST_TEST(IsFloatIterFunc(&ints[0]) == false);
+}
+
+BOOST_AUTO_TEST_SUITE_END()