aboutsummaryrefslogtreecommitdiff
path: root/src/armnn
diff options
context:
space:
mode:
Diffstat (limited to 'src/armnn')
-rw-r--r--src/armnn/LayerSupport.cpp4
-rw-r--r--src/armnn/test/OptionalTest.cpp63
2 files changed, 65 insertions, 2 deletions
diff --git a/src/armnn/LayerSupport.cpp b/src/armnn/LayerSupport.cpp
index 9561136d85..3758ed40f6 100644
--- a/src/armnn/LayerSupport.cpp
+++ b/src/armnn/LayerSupport.cpp
@@ -134,7 +134,7 @@ bool IsConvolution2dSupported(Compute compute,
const TensorInfo& output,
const Convolution2dDescriptor& descriptor,
const TensorInfo& weights,
- const boost::optional<TensorInfo>& biases,
+ const Optional<TensorInfo>& biases,
char* reasonIfUnsupported,
size_t reasonIfUnsupportedMaxLength)
{
@@ -166,7 +166,7 @@ bool IsDepthwiseConvolutionSupported(Compute compute,
const TensorInfo& output,
const DepthwiseConvolution2dDescriptor& descriptor,
const TensorInfo& weights,
- const boost::optional<TensorInfo>& biases,
+ const Optional<TensorInfo>& biases,
char* reasonIfUnsupported,
size_t reasonIfUnsupportedMaxLength)
{
diff --git a/src/armnn/test/OptionalTest.cpp b/src/armnn/test/OptionalTest.cpp
new file mode 100644
index 0000000000..1b5aaa7db6
--- /dev/null
+++ b/src/armnn/test/OptionalTest.cpp
@@ -0,0 +1,63 @@
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// SPDX-License-Identifier: MIT
+//
+#include <boost/test/unit_test.hpp>
+
+#include <armnn/Optional.hpp>
+#include <string>
+
+BOOST_AUTO_TEST_SUITE(OptionalTests)
+
+BOOST_AUTO_TEST_CASE(SimpleStringTests)
+{
+ armnn::Optional<std::string> optionalString;
+ BOOST_TEST(optionalString == false);
+ BOOST_TEST(optionalString.has_value() == false);
+
+ optionalString = std::string("Hello World");
+ BOOST_TEST(optionalString == true);
+ BOOST_TEST(optionalString.has_value() == true);
+ BOOST_TEST(optionalString.value() == "Hello World");
+
+ armnn::Optional<std::string> otherString;
+ otherString = optionalString;
+ BOOST_TEST(otherString == true);
+ BOOST_TEST(otherString.value() == "Hello World");
+
+ optionalString.reset();
+ BOOST_TEST(optionalString == false);
+ BOOST_TEST(optionalString.has_value() == false);
+
+ const std::string stringValue("Hello World");
+ armnn::Optional<std::string> optionalString2(stringValue);
+ BOOST_TEST(optionalString2 == true);
+ BOOST_TEST(optionalString2.has_value() == true);
+ BOOST_TEST(optionalString2.value() == "Hello World");
+
+ armnn::Optional<std::string> optionalString3(std::move(optionalString2));
+ BOOST_TEST(optionalString3 == true);
+ BOOST_TEST(optionalString3.has_value() == true);
+ BOOST_TEST(optionalString3.value() == "Hello World");
+}
+
+BOOST_AUTO_TEST_CASE(SimpleIntTests)
+{
+ const int intValue = 123;
+
+ armnn::Optional<int> optionalInt;
+ BOOST_TEST(optionalInt == false);
+ BOOST_TEST(optionalInt.has_value() == false);
+
+ optionalInt = intValue;
+ BOOST_TEST(optionalInt == true);
+ BOOST_TEST(optionalInt.has_value() == true);
+ BOOST_TEST(optionalInt.value() == intValue);
+
+ armnn::Optional<int> otherOptionalInt;
+ otherOptionalInt = optionalInt;
+ BOOST_TEST(otherOptionalInt == true);
+ BOOST_TEST(otherOptionalInt.value() == intValue);
+}
+
+BOOST_AUTO_TEST_SUITE_END()