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 Intel Corporation
8 #ifndef OPENCV_GAPI_CORE_TESTS_HPP
9 #define OPENCV_GAPI_CORE_TESTS_HPP
13 #include "gapi_tests_common.hpp"
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"};
43 struct PrintMathOpCoreParams
45 template <class TestParams>
46 std::string operator()(const ::testing::TestParamInfo<TestParams>& info) const
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)
56 <<"_"<<(std::get<5>(info.param)+1)
57 <<"_"<<std::get<6>(info.param)
58 <<"_"<<std::get<7>(info.param);
63 struct PrintCmpCoreParams
65 template <class TestParams>
66 std::string operator()(const ::testing::TestParamInfo<TestParams>& info) const
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)
75 <<"_"<<std::get<4>(info.param);
80 struct PrintBWCoreParams
82 template <class TestParams>
83 std::string operator()(const ::testing::TestParamInfo<TestParams>& info) const
86 cv::Size sz = std::get<2>(info.param);
87 ss<<BitwiseOperations[std::get<0>(info.param)]
88 <<"_"<<std::get<1>(info.param)
91 <<"_"<<std::get<3>(info.param);
96 struct PrintNormCoreParams
98 template <class TestParams>
99 std::string operator()(const ::testing::TestParamInfo<TestParams>& info) const
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)
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, cv::GCompileArgs>> {};
128 struct AddWeightedTest : public TestParams<std::tuple<int,cv::Size,int,bool, cv::GCompileArgs>>{};
129 struct NormTest : public TestParams<std::tuple<NormTypes,int,cv::Size, 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<int, int, cv::Size, cv::Size, double, cv::GCompileArgs>> {};
137 struct ResizeTestFxFy : public TestWithParam<std::tuple<int, int, cv::Size, double, 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>> {};
151 #endif //OPENCV_GAPI_CORE_TESTS_HPP