COMPMID-3478: Allow SubTensors with XY indexing

Remove limitations on sub-tensor creation and allow any possible
indexing as long as it honors the parent tensor shape.

In case of padding expansion on a subtensor, an error is raised if
the sub-tensor is indexed on the XY dimensions.

Change-Id: Ibb5183a6cb7421f55068b47c06b43ebde0f6e9a5
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3427
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
diff --git a/tests/framework/Asserts.h b/tests/framework/Asserts.h
index 9d6d4fa..3b91b32 100644
--- a/tests/framework/Asserts.h
+++ b/tests/framework/Asserts.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2020 ARM Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -135,6 +135,47 @@
         arm_compute::test::framework::Framework::get().clear_test_info();                                                                     \
     } while(false)
 
+#define ARM_COMPUTE_EXPECT_NO_THROW(X, LEVEL)                                                                                                 \
+    do                                                                                                                                        \
+    {                                                                                                                                         \
+        try                                                                                                                                   \
+        {                                                                                                                                     \
+            const auto &x = X;                                                                                                                \
+            (void)x;                                                                                                                          \
+        }                                                                                                                                     \
+        catch(...)                                                                                                                            \
+        {                                                                                                                                     \
+            std::stringstream msg;                                                                                                            \
+            msg << "Expectation '" #X "' to not throw failed.\n";                                                                             \
+            arm_compute::test::framework::Framework::get().print_test_info(msg);                                                              \
+            arm_compute::test::framework::Framework::get().log_failed_expectation(arm_compute::test::framework::TestError(msg.str(), LEVEL)); \
+        }                                                                                                                                     \
+        arm_compute::test::framework::Framework::get().clear_test_info();                                                                     \
+    } while(false)
+
+#define ARM_COMPUTE_EXPECT_THROW(X, LEVEL)                                                                                                    \
+    do                                                                                                                                        \
+    {                                                                                                                                         \
+        bool exception_caught = false;                                                                                                        \
+        try                                                                                                                                   \
+        {                                                                                                                                     \
+            const auto &x = X;                                                                                                                \
+            (void)x;                                                                                                                          \
+        }                                                                                                                                     \
+        catch(...)                                                                                                                            \
+        {                                                                                                                                     \
+            exception_caught = true;                                                                                                          \
+        }                                                                                                                                     \
+        if(!exception_caught)                                                                                                                 \
+        {                                                                                                                                     \
+            std::stringstream msg;                                                                                                            \
+            msg << "Expectation '" #X "' to throw failed.\n";                                                                                 \
+            arm_compute::test::framework::Framework::get().print_test_info(msg);                                                              \
+            arm_compute::test::framework::Framework::get().log_failed_expectation(arm_compute::test::framework::TestError(msg.str(), LEVEL)); \
+        }                                                                                                                                     \
+        arm_compute::test::framework::Framework::get().clear_test_info();                                                                     \
+    } while(false)
+
 #define ARM_COMPUTE_ASSERT_FAIL(MSG)                                                                              \
     do                                                                                                            \
     {                                                                                                             \