Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / fluid / modules / gapi / test / gapi_util_tests.cpp
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.
4 //
5 // Copyright (C) 2018-2019 Intel Corporation
6
7
8 #include "test_precomp.hpp"
9
10 #include <type_traits>
11
12 #include "opencv2/gapi/util/util.hpp"
13
14 namespace opencv_test
15 {
16
17 TEST(GAPIUtil, AllSatisfy)
18 {
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");
23
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");
30 }
31
32 TEST(GAPIUtil, AllButLast)
33 {
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)");
37
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");
41 }
42
43 } // namespace opencv_test