diff options
Diffstat (limited to 'tests/validation/UNIT')
-rw-r--r-- | tests/validation/UNIT/SubTensorInfo.cpp | 11 | ||||
-rw-r--r-- | tests/validation/UNIT/TensorInfo.cpp | 13 |
2 files changed, 21 insertions, 3 deletions
diff --git a/tests/validation/UNIT/SubTensorInfo.cpp b/tests/validation/UNIT/SubTensorInfo.cpp index 5a930620ce..ca5e46550c 100644 --- a/tests/validation/UNIT/SubTensorInfo.cpp +++ b/tests/validation/UNIT/SubTensorInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Arm Limited. + * Copyright (c) 2020-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -69,6 +69,7 @@ TEST_CASE(SubTensorCreation, framework::DatasetMode::ALL) * - A) Extend padding when SubTensor XY does not match parent tensor should fail * B) Extend with zero padding when SubTensor XY does not match parent tensor should succeed * - C) Extend padding when SubTensor XY matches parent tensor should succeed + * - D) Set lock padding to true, so that extend padding would fail */ TEST_CASE(SubTensorPaddingExpansion, framework::DatasetMode::ALL) { @@ -95,6 +96,14 @@ TEST_CASE(SubTensorPaddingExpansion, framework::DatasetMode::ALL) ARM_COMPUTE_EXPECT(tensor_info.padding().top == 2, framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(tensor_info.padding().right == 1, framework::LogLevel::ERRORS); } + + // Test D + { + TensorInfo tensor_info(TensorShape(23U, 17U, 3U), 1, DataType::F32); + SubTensorInfo sub_tensor_info(&tensor_info, TensorShape(4U, 3U, 1U), Coordinates(5, 2, 1)); + sub_tensor_info.set_lock_paddings(true); + ARM_COMPUTE_EXPECT_THROW(sub_tensor_info.extend_padding(PaddingSize(2, 1)), framework::LogLevel::ERRORS); + } } TEST_SUITE_END() // SubTensorInfo diff --git a/tests/validation/UNIT/TensorInfo.cpp b/tests/validation/UNIT/TensorInfo.cpp index 50b26293c9..b79c1e9253 100644 --- a/tests/validation/UNIT/TensorInfo.cpp +++ b/tests/validation/UNIT/TensorInfo.cpp @@ -184,8 +184,17 @@ TEST_CASE(SymmPerChannelQuantizationInfo, framework::DatasetMode::ALL) ARM_COMPUTE_EXPECT(info.quantization_info().offset().empty(), framework::LogLevel::ERRORS); } -TEST_SUITE_END() // TensorInfoValidation -TEST_SUITE_END() +/** Validates lock paddings flag*/ +TEST_CASE(SubTensorPaddingExpansion, framework::DatasetMode::ALL) +{ + TensorInfo tensor_info(TensorShape(23U, 17U, 3U), 1, DataType::F32); + tensor_info.set_lock_paddings(true); + + // Now lock padding is set to true, therefore the extend padding would fail + ARM_COMPUTE_EXPECT_THROW(tensor_info.extend_padding(PaddingSize(2, 1)), framework::LogLevel::ERRORS); +} +TEST_SUITE_END() // TensorInfo +TEST_SUITE_END() // UNIT } // namespace validation } // namespace test } // namespace arm_compute |