| 95 | TEST_SUITE(NEON) |
| 96 | TEST_SUITE(Scale) |
| 97 | TEST_SUITE(Validate) |
| 98 | |
| 99 | /** Validate test suite is to test ARM_COMPUTE_RETURN_ON_* macros |
| 100 | * we use to check the validity of given arguments in @ref NEScale |
| 101 | * Since this is using validate() of @ref NEScale, which pre-adjust |
| 102 | * arguments for the kernel, the following conditions in |
| 103 | * the kernel are not currently tested. |
| 104 | * - The same input and output |
| 105 | * - Data type of offset, dx and dy |
| 106 | * This suite also tests two different validate() APIs - one is |
| 107 | * using @ref ScaleKernelInfo and the other one is more verbose |
| 108 | * one calls the other one - in the same test case. Even though |
| 109 | * there are possibility that it makes debugging for regression |
| 110 | * harder, belows are reasons of this test case implementation. |
| 111 | * - The more verbose one is just a wrapper function calls |
| 112 | * the other one without any additional logic. So we are |
| 113 | * safe to merge two tests into one. |
| 114 | * - A large amount of code duplication is test suite can be prevented. |
| 115 | */ |
| 116 | |
| 117 | const auto input_shape = TensorShape{2, 3, 3, 2}; |
| 118 | const auto output_shape = TensorShape{4, 6, 3, 2}; |
| 119 | |
| 120 | constexpr auto default_data_type = DataType::U8; |
| 121 | constexpr auto default_data_layout = DataLayout::NHWC; |
| 122 | constexpr auto default_interpolation_policy = InterpolationPolicy::NEAREST_NEIGHBOR; |
| 123 | constexpr auto default_border_mode = BorderMode::CONSTANT; |
| 124 | constexpr auto default_sampling_policy = SamplingPolicy::CENTER; |
| 125 | |
| 126 | TEST_CASE(NullPtr, framework::DatasetMode::ALL) |
| 127 | { |
| 128 | const auto input = TensorInfo{input_shape, 1, default_data_type, default_data_layout}; |
| 129 | const auto output = TensorInfo{output_shape, 1, default_data_type, default_data_layout}; |
| 130 | Status result{}; |
| 131 | |
| 132 | // nullptr is given as input |
| 133 | result = NEScale::validate(nullptr, &output, |
| 134 | ScaleKernelInfo{default_interpolation_policy, default_border_mode, PixelValue(), |
| 135 | SamplingPolicy::CENTER, false}); |
| 136 | ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS); |
| 137 | |
| 138 | // nullptr is given as output |
| 139 | result = NEScale::validate(&input, nullptr, |
| 140 | ScaleKernelInfo{default_interpolation_policy, default_border_mode, PixelValue(), |
| 141 | SamplingPolicy::CENTER, false}); |
| 142 | ARM_COMPUTE_EXPECT(bool(result) == false, framework::LogLevel::ERRORS); |
| 143 | } |
| 144 | |
| 145 | TEST_CASE(SupportDataType, framework::DatasetMode::ALL) |
| 146 | { |
| 147 | const std::map<DataType, bool> supported_data_types = { |
| 148 | {DataType::U8, true}, |
| 149 | {DataType::S8, false}, |
| 150 | {DataType::QSYMM8, false}, |
| 151 | {DataType::QASYMM8, true}, |
| 152 | {DataType::QASYMM8_SIGNED, true}, |
| 153 | {DataType::QSYMM8_PER_CHANNEL, false}, |
| 154 | {DataType::U16, false}, |
no test coverage detected