Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / fluid / modules / gapi / test / common / gapi_core_tests.hpp
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 #ifndef OPENCV_GAPI_CORE_TESTS_HPP
9 #define OPENCV_GAPI_CORE_TESTS_HPP
10
11 #include <iostream>
12
13 #include "gapi_tests_common.hpp"
14
15 namespace opencv_test
16 {
17 enum mathOp
18 {
19     ADD = 0,
20     SUB = 1,
21     MUL = 2,
22     DIV = 3
23 };
24
25 enum bitwiseOp
26 {
27     AND = 0,
28     OR = 1,
29     XOR = 2,
30     NOT = 3
31 };
32
33 namespace
34 {
35 const char *MathOperations[] = {"ADD", "SUB", "MUL", "DIV"};
36 const char *BitwiseOperations[] = {"And", "Or", "Xor"};
37 const char *CompareOperations[] = {"CMP_EQ", "CMP_GT", "CMP_GE", "CMP_LT", "CMP_LE", "CMP_NE"};
38 //corresponds to OpenCV
39 const char *NormOperations[] = {"", "NORM_INF", "NORM_L1", "","NORM_L2"};
40 }
41
42
43 struct PrintMathOpCoreParams
44 {
45     template <class TestParams>
46     std::string operator()(const ::testing::TestParamInfo<TestParams>& info) const
47     {
48         std::stringstream ss;
49         cv::Size sz = std::get<4>(info.param);
50         ss<<MathOperations[std::get<0>(info.param)]
51                     <<"_"<<std::get<1>(info.param)
52                     <<"_"<<std::get<2>(info.param)
53                     <<"_"<<(int)std::get<3>(info.param)
54                     <<"_"<<sz.width
55                     <<"x"<<sz.height
56                     <<"_"<<(std::get<5>(info.param)+1)
57                     <<"_"<<std::get<6>(info.param)
58                     <<"_"<<std::get<7>(info.param);
59         return ss.str();
60    }
61 };
62
63 struct PrintCmpCoreParams
64 {
65     template <class TestParams>
66     std::string operator()(const ::testing::TestParamInfo<TestParams>& info) const
67     {
68         std::stringstream ss;
69         cv::Size sz = std::get<3>(info.param);
70         ss<<CompareOperations[std::get<0>(info.param)]
71                     <<"_"<<std::get<1>(info.param)
72                     <<"_"<<std::get<2>(info.param)
73                     <<"_"<<sz.width
74                     <<"x"<<sz.height
75                     <<"_"<<std::get<4>(info.param);
76         return ss.str();
77    }
78 };
79
80 struct PrintBWCoreParams
81 {
82     template <class TestParams>
83     std::string operator()(const ::testing::TestParamInfo<TestParams>& info) const
84     {
85         std::stringstream ss;
86         cv::Size sz = std::get<2>(info.param);
87         ss<<BitwiseOperations[std::get<0>(info.param)]
88                     <<"_"<<std::get<1>(info.param)
89                     <<"_"<<sz.width
90                     <<"x"<<sz.height
91                     <<"_"<<std::get<3>(info.param);
92         return ss.str();
93    }
94 };
95
96 struct PrintNormCoreParams
97 {
98     template <class TestParams>
99     std::string operator()(const ::testing::TestParamInfo<TestParams>& info) const
100     {
101         std::stringstream ss;
102         cv::Size sz = std::get<2>(info.param);
103         ss<<NormOperations[std::get<0>(info.param)]
104                     <<"_"<<std::get<1>(info.param)
105                     <<"_"<<sz.width
106                     <<"x"<<sz.height;
107         return ss.str();
108    }
109 };
110
111 struct MathOpTest        : public TestParams<std::tuple<mathOp,bool,int,double,cv::Size,int,bool,bool,cv::GCompileArgs>>{};
112 struct MulDoubleTest     : public TestParams<std::tuple<int,cv::Size,int,bool,cv::GCompileArgs>>{};
113 struct DivTest           : public TestParams<std::tuple<int,cv::Size,int,bool, cv::GCompileArgs>>{};
114 struct DivCTest          : public TestParams<std::tuple<int,cv::Size,int,bool, cv::GCompileArgs>>{};
115 struct MeanTest          : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>> {};
116 struct MaskTest          : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>> {};
117 struct Polar2CartTest    : public TestParams<std::tuple<cv::Size,bool, cv::GCompileArgs>> {};
118 struct Cart2PolarTest    : public TestParams<std::tuple<cv::Size,bool, cv::GCompileArgs>> {};
119 struct CmpTest           : public TestParams<std::tuple<CmpTypes,bool,int,cv::Size,bool, cv::GCompileArgs>>{};
120 struct BitwiseTest       : public TestParams<std::tuple<bitwiseOp,int,cv::Size,bool, cv::GCompileArgs>>{};
121 struct NotTest           : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>> {};
122 struct SelectTest        : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>> {};
123 struct MinTest           : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>>{};
124 struct MaxTest           : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>>{};
125 struct AbsDiffTest       : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>>{};
126 struct AbsDiffCTest      : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>> {};
127 struct SumTest           : public TestParams<std::tuple<int, cv::Size,bool, compare_scalar_f, cv::GCompileArgs>> {};
128 struct AddWeightedTest   : public TestParams<std::tuple<int,cv::Size,int,bool, compare_f,cv::GCompileArgs>>{};
129 struct NormTest          : public TestParams<std::tuple<NormTypes,int,cv::Size, compare_scalar_f, cv::GCompileArgs>>{};
130 struct IntegralTest      : public TestWithParam<std::tuple<int,cv::Size, cv::GCompileArgs>> {};
131 struct ThresholdTest     : public TestParams<std::tuple<int,cv::Size,int,bool, cv::GCompileArgs>> {};
132 struct ThresholdOTTest   : public TestParams<std::tuple<int,cv::Size,int,bool, cv::GCompileArgs>> {};
133 struct InRangeTest       : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>> {};
134 struct Split3Test        : public TestParams<std::tuple<cv::Size, cv::GCompileArgs>> {};
135 struct Split4Test        : public TestParams<std::tuple<cv::Size, cv::GCompileArgs>> {};
136 struct ResizeTest        : public TestWithParam<std::tuple<compare_f, int, int, cv::Size, cv::Size, cv::GCompileArgs>> {};
137 struct ResizeTestFxFy    : public TestWithParam<std::tuple<compare_f, int, int, cv::Size, double, double, cv::GCompileArgs>> {};
138 struct Merge3Test        : public TestParams<std::tuple<cv::Size, cv::GCompileArgs>> {};
139 struct Merge4Test        : public TestParams<std::tuple<cv::Size, cv::GCompileArgs>> {};
140 struct RemapTest         : public TestParams<std::tuple<int,cv::Size,bool, cv::GCompileArgs>> {};
141 struct FlipTest          : public TestParams<std::tuple<int, int, cv::Size,bool, cv::GCompileArgs>> {};
142 struct CropTest          : public TestParams<std::tuple<int,cv::Rect,cv::Size,bool, cv::GCompileArgs>> {};
143 struct ConcatHorTest     : public TestWithParam<std::tuple<int, cv::Size, cv::GCompileArgs>> {};
144 struct ConcatVertTest    : public TestWithParam<std::tuple<int, cv::Size, cv::GCompileArgs>> {};
145 struct ConcatVertVecTest : public TestWithParam<std::tuple<int, cv::Size, cv::GCompileArgs>> {};
146 struct ConcatHorVecTest  : public TestWithParam<std::tuple<int, cv::Size, cv::GCompileArgs>> {};
147 struct LUTTest           : public TestParams<std::tuple<int, int, cv::Size,bool, cv::GCompileArgs>> {};
148 struct ConvertToTest     : public TestParams<std::tuple<int, int, cv::Size, cv::GCompileArgs>> {};
149 struct PhaseTest         : public TestParams<std::tuple<int, cv::Size, bool, cv::GCompileArgs>> {};
150 struct SqrtTest          : public TestParams<std::tuple<int, cv::Size, cv::GCompileArgs>> {};
151 } // opencv_test
152
153 #endif //OPENCV_GAPI_CORE_TESTS_HPP