diff options
author | Moritz Pflanzer <moritz.pflanzer@arm.com> | 2017-09-01 20:41:12 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:35:24 +0000 |
commit | a09de0c8b2ed0f1481502d3b023375609362d9e3 (patch) | |
tree | e34b56d9ca69b025d7d9b943cc4df59cd458f6cb /framework/datasets | |
parent | 5280071b336d53aff94ca3a6c70ebbe6bf03f4c3 (diff) | |
download | ComputeLibrary-a09de0c8b2ed0f1481502d3b023375609362d9e3.tar.gz |
COMPMID-415: Rename and move tests
The boost validation is now "standalone" in validation_old and builds as
arm_compute_validation_old. The new validation builds now as
arm_compute_validation.
Change-Id: Ib93ba848a25680ac60afb92b461d574a0757150d
Reviewed-on: http://mpd-gerrit.cambridge.arm.com/86187
Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'framework/datasets')
-rw-r--r-- | framework/datasets/CartesianProductDataset.h | 165 | ||||
-rw-r--r-- | framework/datasets/ContainerDataset.h | 148 | ||||
-rw-r--r-- | framework/datasets/Dataset.h | 86 | ||||
-rw-r--r-- | framework/datasets/Datasets.h | 35 | ||||
-rw-r--r-- | framework/datasets/InitializerListDataset.h | 135 | ||||
-rw-r--r-- | framework/datasets/JoinDataset.h | 148 | ||||
-rw-r--r-- | framework/datasets/RangeDataset.h | 141 | ||||
-rw-r--r-- | framework/datasets/SingletonDataset.h | 138 | ||||
-rw-r--r-- | framework/datasets/ZipDataset.h | 139 |
9 files changed, 0 insertions, 1135 deletions
diff --git a/framework/datasets/CartesianProductDataset.h b/framework/datasets/CartesianProductDataset.h deleted file mode 100644 index f6e45ddc12..0000000000 --- a/framework/datasets/CartesianProductDataset.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_DATASET_CARTESIAN_PRODUCT -#define ARM_COMPUTE_TEST_DATASET_CARTESIAN_PRODUCT - -#include "Dataset.h" - -#include <string> -#include <tuple> -#include <utility> - -namespace arm_compute -{ -namespace test -{ -namespace framework -{ -namespace dataset -{ -/** Implementation of a dataset representing all combinations of values of the input datasets. - * - * For example, for the inputs {1, 2} and {3, 4} this dataset virtually - * represents the values {(1, 3), (1, 4), (2, 3), (2, 4)}. - */ -template <typename T, typename U> -class CartesianProductDataset : public Dataset -{ -private: - using T_noref = typename std::remove_reference<T>::type; - using U_noref = typename std::remove_reference<U>::type; - using iter1_type = typename T_noref::iterator; - using iter2_type = typename U_noref::iterator; - -public: - /** Construct dataset from the given datasets. - * - * @param[in] dataset1 First dataset. - * @param[in] dataset2 Second dataset. - */ - CartesianProductDataset(T &&dataset1, U &&dataset2) - : _dataset1{ std::forward<T>(dataset1) }, - _dataset2{ std::forward<U>(dataset2) } - { - } - - CartesianProductDataset(CartesianProductDataset &&) = default; - - /** Type of the dataset. */ - using type = decltype(std::tuple_cat(*std::declval<iter1_type>(), *std::declval<iter2_type>())); - - /** Iterator for the dataset. */ - struct iterator - { - iterator(const T_noref *dataset1, const U_noref *dataset2) - : _iter1{ dataset1->begin() }, - _dataset2{ dataset2 }, - _iter2{ dataset2->begin() } - { - } - - iterator(const iterator &) = default; - iterator &operator=(const iterator &) = default; - iterator(iterator &&) = default; - iterator &operator=(iterator &&) = default; - - ~iterator() = default; - - std::string description() const - { - return _iter1.description() + ":" + _iter2.description(); - } - - CartesianProductDataset::type operator*() const - { - return std::tuple_cat(*_iter1, *_iter2); - } - - iterator &operator++() - { - ++_second_pos; - - if(_second_pos < _dataset2->size()) - { - ++_iter2; - } - else - { - _second_pos = 0; - _iter2 = _dataset2->begin(); - - ++_iter1; - } - - return *this; - } - - private: - iter1_type _iter1; - const U_noref *_dataset2; - iter2_type _iter2; - int _first_pos{ 0 }; - int _second_pos{ 0 }; - }; - - /** Iterator pointing at the begin of the dataset. - * - * @return Iterator for the dataset. - */ - iterator begin() const - { - return iterator(&_dataset1, &_dataset2); - } - - /** Size of the dataset. - * - * @return Number of values in the dataset. - */ - int size() const - { - return _dataset1.size() * _dataset2.size(); - } - -private: - T _dataset1; - U _dataset2; -}; - -/** Helper function to create a @ref CartesianProductDataset. - * - * @param[in] dataset1 First dataset. - * @param[in] dataset2 Second dataset. - * - * @return A grid dataset. - */ -template <typename T, typename U> -CartesianProductDataset<T, U> combine(T &&dataset1, U &&dataset2) -{ - return CartesianProductDataset<T, U>(std::forward<T>(dataset1), std::forward<U>(dataset2)); -} -} // namespace dataset -} // namespace framework -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_DATASET_CARTESIAN_PRODUCT */ diff --git a/framework/datasets/ContainerDataset.h b/framework/datasets/ContainerDataset.h deleted file mode 100644 index bdca97cbac..0000000000 --- a/framework/datasets/ContainerDataset.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_DATASET_CONTAINER -#define ARM_COMPUTE_TEST_DATASET_CONTAINER - -#include "Dataset.h" -#include "support/ToolchainSupport.h" - -#include <string> -#include <tuple> -#include <type_traits> -#include <utility> -#include <vector> - -namespace arm_compute -{ -namespace test -{ -namespace framework -{ -namespace dataset -{ -/** Base case. Nothing is a container. */ -template <typename T> -struct is_container : public std::false_type -{ -}; - -/** Vector is considered a container. */ -template <typename V, typename A> -struct is_container<std::vector<V, A>> : public std::true_type -{ -}; - -/** Implementation of a dataset created from a container. */ -template <typename T> -class ContainerDataset : public NamedDataset -{ -private: - using container_value_type = typename T::value_type; - using container_const_iterator = typename T::const_iterator; - -public: - /** Construct dataset with given name and values from the container. - * - * @param[in] name Description of the values. - * @param[in] container Values for the dataset. - */ - ContainerDataset(std::string name, T &&container) - : NamedDataset{ std::move(name) }, _container(std::forward<T>(container)) - { - } - - ContainerDataset(ContainerDataset &&) = default; - - /** Type of the dataset. */ - using type = std::tuple<container_value_type>; - - /** Iterator for the dataset. */ - struct iterator - { - iterator(std::string name, container_const_iterator iterator) - : _name{ name }, _iterator{ iterator } - { - } - - std::string description() const - { - using support::cpp11::to_string; - return _name + "=" + to_string(*_iterator); - } - - ContainerDataset::type operator*() const - { - return std::make_tuple(*_iterator); - } - - iterator &operator++() - { - ++_iterator; - return *this; - } - - private: - std::string _name; - container_const_iterator _iterator; - }; - - /** Iterator pointing at the begin of the dataset. - * - * @return Iterator for the dataset. - */ - iterator begin() const - { - return iterator(name(), _container.cbegin()); - } - - /** Size of the dataset. - * - * @return Number of values in the dataset. - */ - int size() const - { - return _container.size(); - } - -private: - T _container; -}; - -/** Helper function to create a @ref ContainerDataset. - * - * @param[in] name Name of the dataset. - * @param[in] values Container. - * - * @return A container dataset. - */ -template <typename T> -typename std::enable_if<is_container<T>::value, ContainerDataset<T>>::type make(std::string name, T &&values) -{ - return ContainerDataset<T>(std::move(name), std::forward<T>(values)); -} -} // namespace dataset -} // namespace framework -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_DATASET_CONTAINER */ diff --git a/framework/datasets/Dataset.h b/framework/datasets/Dataset.h deleted file mode 100644 index d91673073a..0000000000 --- a/framework/datasets/Dataset.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_DATASET -#define ARM_COMPUTE_TEST_DATASET - -#include <string> -#include <utility> - -namespace arm_compute -{ -namespace test -{ -namespace framework -{ -namespace dataset -{ -/** Abstract dataset base class. */ -class Dataset -{ -protected: - Dataset() = default; - ~Dataset() = default; - -public: - Dataset(Dataset &&) = default; -}; - -/** Abstract implementation of a named dataset. - * - * The name should describe the values of the dataset. - */ -class NamedDataset : public Dataset -{ -protected: - /** Construct the dataset with the given name. - * - * @param[in] name Description of the values. - */ - explicit NamedDataset(std::string name) - : _name{ std::move(name) } - { - } - - ~NamedDataset() = default; - -public: - NamedDataset(NamedDataset &&) = default; - - /** Return name of the dataset. - * - * @return Description of the values. - */ - std::string name() const - { - return _name; - } - -protected: - const std::string _name; -}; -} // namespace dataset -} // namespace framework -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_DATASET */ diff --git a/framework/datasets/Datasets.h b/framework/datasets/Datasets.h deleted file mode 100644 index c0e5822e17..0000000000 --- a/framework/datasets/Datasets.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_DATASETS -#define ARM_COMPUTE_TEST_DATASETS - -#include "CartesianProductDataset.h" -#include "ContainerDataset.h" -#include "InitializerListDataset.h" -#include "JoinDataset.h" -#include "RangeDataset.h" -#include "SingletonDataset.h" -#include "ZipDataset.h" - -#endif /* ARM_COMPUTE_TEST_DATASETS */ diff --git a/framework/datasets/InitializerListDataset.h b/framework/datasets/InitializerListDataset.h deleted file mode 100644 index 7d32234fab..0000000000 --- a/framework/datasets/InitializerListDataset.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_DATASET_LIST -#define ARM_COMPUTE_TEST_DATASET_LIST - -#include "Dataset.h" -#include "support/ToolchainSupport.h" - -#include <initializer_list> -#include <string> -#include <tuple> -#include <utility> -#include <vector> - -namespace arm_compute -{ -namespace test -{ -namespace framework -{ -namespace dataset -{ -/** Implementation of a dataset created from an initializer list. */ -template <typename T> -class InitializerListDataset final : public NamedDataset -{ -private: - using data_const_iterator = typename std::vector<T>::const_iterator; - -public: - /** Construct dataset with given name and values from the container. - * - * @param[in] name Description of the values. - * @param[in] list Values for the dataset. - */ - InitializerListDataset(std::string name, std::initializer_list<T> &&list) - : NamedDataset{ std::move(name) }, _data(std::forward<std::initializer_list<T>>(list)) - { - } - - InitializerListDataset(InitializerListDataset &&) = default; - - /** Type of the dataset. */ - using type = std::tuple<T>; - - /** Iterator for the dataset. */ - struct iterator - { - iterator(std::string name, data_const_iterator iterator) - : _name{ name }, _iterator{ iterator } - { - } - - std::string description() const - { - using support::cpp11::to_string; - return _name + "=" + to_string(*_iterator); - } - - InitializerListDataset::type operator*() const - { - return std::make_tuple(*_iterator); - } - - iterator &operator++() - { - ++_iterator; - return *this; - } - - private: - std::string _name; - data_const_iterator _iterator; - }; - - /** Iterator pointing at the begin of the dataset. - * - * @return Iterator for the dataset. - */ - iterator begin() const - { - return iterator(name(), _data.cbegin()); - } - - /** Size of the dataset. - * - * @return Number of values in the dataset. - */ - int size() const - { - return _data.size(); - } - -private: - std::vector<T> _data; -}; - -/** Helper function to create an @ref InitializerListDataset. - * - * @param[in] name Name of the dataset. - * @param[in] list Initializer list. - * - * @return An initializer list dataset. - */ -template <typename T> -InitializerListDataset<T> make(std::string name, std::initializer_list<T> &&list) -{ - return InitializerListDataset<T>(std::move(name), std::forward<std::initializer_list<T>>(list)); -} -} // namespace dataset -} // namespace framework -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_DATASET_LIST */ diff --git a/framework/datasets/JoinDataset.h b/framework/datasets/JoinDataset.h deleted file mode 100644 index eded6e0259..0000000000 --- a/framework/datasets/JoinDataset.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_DATASET_JOIN -#define ARM_COMPUTE_TEST_DATASET_JOIN - -#include "Dataset.h" - -#include <string> -#include <tuple> -#include <utility> - -namespace arm_compute -{ -namespace test -{ -namespace framework -{ -namespace dataset -{ -/** Implementation of a dataset representing the concatenation of the input datasets. - * - * For example, for the inputs {1, 2} and {3, 4} this dataset virtually - * represents the values {1, 2, 3, 4}. - */ -template <typename T, typename U> -class JoinDataset : public Dataset -{ -private: - using iter1_type = typename T::iterator; - using iter2_type = typename U::iterator; - -public: - /** Construct dataset from the given datasets. - * - * @param[in] dataset1 First dataset. - * @param[in] dataset2 Second dataset. - */ - JoinDataset(T &&dataset1, U &&dataset2) - : _dataset1{ std::forward<T>(dataset1) }, - _dataset2{ std::forward<U>(dataset2) } - { - } - - JoinDataset(JoinDataset &&) = default; - - /** Type of the dataset. */ - using type = typename T::type; - - /** Iterator for the dataset. */ - struct iterator - { - iterator(const T *dataset1, const U *dataset2) - : _iter1{ dataset1->begin() }, _iter2{ dataset2->begin() }, _first_size{ dataset1->size() } - { - } - - std::string description() const - { - return _first_size > 0 ? _iter1.description() : _iter2.description(); - } - - JoinDataset::type operator*() const - { - return _first_size > 0 ? *_iter1 : *_iter2; - } - - iterator &operator++() - { - if(_first_size > 0) - { - --_first_size; - ++_iter1; - } - else - { - ++_iter2; - } - - return *this; - } - - private: - iter1_type _iter1; - iter2_type _iter2; - int _first_size; - }; - - /** Iterator pointing at the begin of the dataset. - * - * @return Iterator for the dataset. - */ - iterator begin() const - { - return iterator(&_dataset1, &_dataset2); - } - - /** Size of the dataset. - * - * @return Number of values in the dataset. - */ - int size() const - { - return _dataset1.size() + _dataset2.size(); - } - -private: - T _dataset1; - U _dataset2; -}; - -/** Helper function to create a @ref JoinDataset. - * - * @param[in] dataset1 First dataset. - * @param[in] dataset2 Second dataset. - * - * @return A join dataset. - */ -template <typename T, typename U> -JoinDataset<T, U> concat(T &&dataset1, U &&dataset2) -{ - return JoinDataset<T, U>(std::forward<T>(dataset1), std::forward<U>(dataset2)); -} -} // namespace dataset -} // namespace framework -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_DATASET_JOIN */ diff --git a/framework/datasets/RangeDataset.h b/framework/datasets/RangeDataset.h deleted file mode 100644 index 637abe0a83..0000000000 --- a/framework/datasets/RangeDataset.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_DATASET_RANGE -#define ARM_COMPUTE_TEST_DATASET_RANGE - -#include "Dataset.h" -#include "support/ToolchainSupport.h" - -#include <string> -#include <tuple> -#include <type_traits> -#include <utility> - -namespace arm_compute -{ -namespace test -{ -namespace framework -{ -namespace dataset -{ -/** Implementation of a dataset created from a range of values. - * - * The range is inclusive of the first value but exclusive of the last, i.e. [start, end). - */ -template <typename T> -class RangeDataset final : public NamedDataset -{ -public: - /** Construct dataset with given name and values in the specified range. - * - * @param[in] name Description of the values. - * @param[in] start Begin of the range. - * @param[in] end End of the range. - * @param[in] step Step size. - */ - RangeDataset(std::string name, T start, T end, T step = 1) - : NamedDataset{ std::move(name) }, _start{ start }, _end{ end }, _step{ step } - { - } - - RangeDataset(RangeDataset &&) = default; - - /** Type of the dataset. */ - using type = std::tuple<T>; - - /** Iterator for the dataset. */ - struct iterator - { - iterator(std::string name, T start, T step) - : _name{ name }, _value{ start }, _step{ step } - { - } - - std::string description() const - { - using support::cpp11::to_string; - return _name + "=" + to_string(_value); - } - - RangeDataset::type operator*() const - { - return std::make_tuple(_value); - } - - iterator &operator++() - { - _value += _step; - return *this; - } - - private: - std::string _name; - T _value; - T _step; - }; - - /** Iterator pointing at the begin of the dataset. - * - * @return Iterator for the dataset. - */ - iterator begin() const - { - return iterator(name(), _start, _step); - } - - /** Size of the dataset. - * - * @return Number of values in the dataset. - */ - int size() const - { - return (_end - _start) / std::abs(_step); - } - -private: - T _start; - T _end; - T _step; -}; - -/** Helper function to create a @ref RangeDataset. - * - * @param[in] name Name of the dataset. - * @param[in] start Begin of the range. - * @param[in] end End of the range. - * @param[in] step Step size. - * - * @return A range dataset. - */ -template <typename T> -RangeDataset<T> make(std::string name, T start, T end, T step = 1) -{ - return RangeDataset<T>(std::move(name), start, end, step); -} -} // namespace dataset -} // namespace framework -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_DATASET_RANGE */ diff --git a/framework/datasets/SingletonDataset.h b/framework/datasets/SingletonDataset.h deleted file mode 100644 index 1acb5765e5..0000000000 --- a/framework/datasets/SingletonDataset.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_DATASET_SINGLETON -#define ARM_COMPUTE_TEST_DATASET_SINGLETON - -#include "ContainerDataset.h" -#include "Dataset.h" -#include "support/ToolchainSupport.h" - -#include <string> -#include <tuple> -#include <type_traits> -#include <utility> - -namespace arm_compute -{ -namespace test -{ -namespace framework -{ -namespace dataset -{ -/** Implementation of a dataset holding a single value. */ -template <typename T> -class SingletonDataset : public NamedDataset -{ -public: - /** Construct dataset with given name and value. - * - * @param[in] name Description of the value. - * @param[in] value Value for the dataset. - */ - SingletonDataset(std::string name, T &&value) - : NamedDataset{ std::move(name) }, _value{ std::forward<T>(value) } - { - } - - SingletonDataset(SingletonDataset &&) = default; - - /** Type of the dataset. */ - using type = std::tuple<T>; - - /** Iterator for the dataset. */ - struct iterator - { - iterator(std::string name, const T *value) - : _name{ name }, _value{ value } - { - } - - ~iterator() = default; - - iterator(const iterator &) = default; - iterator &operator=(const iterator &) = default; - iterator(iterator &&) = default; - iterator &operator=(iterator &&) = default; - - std::string description() const - { - using support::cpp11::to_string; - return _name + "=" + to_string(*_value); - } - - SingletonDataset::type operator*() const - { - return std::make_tuple(*_value); - } - - iterator &operator++() - { - return *this; - } - - private: - std::string _name; - const T *_value; - }; - - /** Iterator pointing at the begin of the dataset. - * - * @return Iterator for the dataset. - */ - iterator begin() const - { - return iterator(name(), &_value); - } - - /** Size of the dataset. - * - * @return Number of values in the dataset. - */ - int size() const - { - return 1; - } - -private: - T _value; -}; - -/** Helper function to create a @ref SingletonDataset. - * - * @param[in] name Name of the dataset. - * @param[in] value Value. - * - * @return A singleton dataset. - */ -template <typename T> -typename std::enable_if < !is_container<T>::value, SingletonDataset<T >>::type make(std::string name, T &&value) -{ - return SingletonDataset<T>(std::move(name), std::forward<T>(value)); -} -} // namespace dataset -} // namespace framework -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_DATASET_SINGLETON */ diff --git a/framework/datasets/ZipDataset.h b/framework/datasets/ZipDataset.h deleted file mode 100644 index b95b7209a7..0000000000 --- a/framework/datasets/ZipDataset.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2017 ARM Limited. - * - * SPDX-License-Identifier: MIT - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -#ifndef ARM_COMPUTE_TEST_DATASET_ZIP -#define ARM_COMPUTE_TEST_DATASET_ZIP - -#include "Dataset.h" - -#include <string> -#include <tuple> -#include <utility> - -namespace arm_compute -{ -namespace test -{ -namespace framework -{ -namespace dataset -{ -/** Implementation of a dataset representing pairs of values of the input datasets. - * - * For example, for the inputs {1, 2} and {3, 4} this dataset virtually - * represents the values {(1, 3), (1, 4)}. - */ -template <typename T, typename U> -class ZipDataset : public Dataset -{ -private: - using iter1_type = typename T::iterator; - using iter2_type = typename U::iterator; - -public: - /** Construct dataset from the given datasets. - * - * @param[in] dataset1 First dataset. - * @param[in] dataset2 Second dataset. - */ - ZipDataset(T &&dataset1, U &&dataset2) - : _dataset1{ std::forward<T>(dataset1) }, - _dataset2{ std::forward<U>(dataset2) } - { - } - - ZipDataset(ZipDataset &&) = default; - - /** Type of the dataset. */ - using type = decltype(std::tuple_cat(*std::declval<iter1_type>(), *std::declval<iter2_type>())); - - /** Iterator for the dataset. */ - struct iterator - { - iterator(iter1_type iter1, iter2_type iter2) - : _iter1{ std::move(iter1) }, _iter2{ std::move(iter2) } - { - } - - std::string description() const - { - return _iter1.description() + ":" + _iter2.description(); - } - - ZipDataset::type operator*() const - { - return std::tuple_cat(*_iter1, *_iter2); - } - - iterator &operator++() - { - ++_iter1; - ++_iter2; - return *this; - } - - private: - iter1_type _iter1; - iter2_type _iter2; - }; - - /** Iterator pointing at the begin of the dataset. - * - * @return Iterator for the dataset. - */ - iterator begin() const - { - return iterator(_dataset1.begin(), _dataset2.begin()); - } - - /** Size of the dataset. - * - * @return Number of values in the dataset. - */ - int size() const - { - return std::min(_dataset1.size(), _dataset2.size()); - } - -private: - T _dataset1; - U _dataset2; -}; - -/** Helper function to create a @ref ZipDataset. - * - * @param[in] dataset1 First dataset. - * @param[in] dataset2 Second dataset. - * - * @return A zip dataset. - */ -template <typename T, typename U> -ZipDataset<T, U> zip(T &&dataset1, U &&dataset2) -{ - return ZipDataset<T, U>(std::forward<T>(dataset1), std::forward<U>(dataset2)); -} -} // namespace dataset -} // namespace framework -} // namespace test -} // namespace arm_compute -#endif /* ARM_COMPUTE_TEST_DATASET_ZIP */ |