1 // This file is part of OpenCV project.
2 // It is subject to the license terms in the LICENSE file found in the top-level directory
3 // of this distribution and at http://opencv.org/license.html.
5 // Copyright (C) 2018-2019 Intel Corporation
8 #include "test_precomp.hpp"
10 #include <type_traits>
12 #include "opencv2/gapi/util/util.hpp"
17 TEST(GAPIUtil, AllSatisfy)
19 static_assert(true == cv::detail::all_satisfy<std::is_integral, long, int, char>::value,
20 "[long, int, char] are all integral types");
21 static_assert(true == cv::detail::all_satisfy<std::is_integral, char>::value,
22 "char is an integral type");
24 static_assert(false == cv::detail::all_satisfy<std::is_integral, float, int, char>::value,
25 "[float, int, char] are NOT all integral types");
26 static_assert(false == cv::detail::all_satisfy<std::is_integral, int, char, float>::value,
27 "[int, char, float] are NOT all integral types");
28 static_assert(false == cv::detail::all_satisfy<std::is_integral, float>::value,
29 "float is not an integral types");
32 TEST(GAPIUtil, AllButLast)
34 using test1 = cv::detail::all_but_last<long, int, float>::type;
35 static_assert(true == cv::detail::all_satisfy<std::is_integral, test1>::value,
36 "[long, int] are all integral types (float skipped)");
38 using test2 = cv::detail::all_but_last<int, float, char>::type;
39 static_assert(false == cv::detail::all_satisfy<std::is_integral, test2>::value,
40 "[int, float] are NOT all integral types");
43 } // namespace opencv_test