@@ -77,6 +77,81 @@ TEST_P(NotOperatorTest, OperatorAccuracyTest)
77
77
EXPECT_EQ (0 , cvtest::norm (out_mat_ocv, out_mat_gapi, NORM_INF));
78
78
}
79
79
}
80
+
81
+ namespace for_test
82
+ {
83
+ class Foo {};
84
+
85
+ inline int operator &(Foo, int ) { return 1 ; }
86
+ inline int operator |(Foo, int ) { return 1 ; }
87
+ inline int operator ^(Foo, int ) { return 1 ; }
88
+ inline int operator ~(Foo) { return 1 ; }
89
+
90
+ inline int operator +(Foo, int ) { return 1 ; }
91
+ inline int operator -(Foo, int ) { return 1 ; }
92
+ inline int operator *(Foo, int ) { return 1 ; }
93
+ inline int operator /(Foo, int ) { return 1 ; }
94
+
95
+ inline int operator > (Foo, int ) { return 1 ; }
96
+ inline int operator >=(Foo, int ) { return 1 ; }
97
+ inline int operator < (Foo, int ) { return 1 ; }
98
+ inline int operator <=(Foo, int ) { return 1 ; }
99
+ inline int operator ==(Foo, int ) { return 1 ; }
100
+ inline int operator !=(Foo, int ) { return 1 ; }
101
+
102
+ TEST (CVNamespaceOperatorsTest, OperatorCompilationTest)
103
+ {
104
+ cv::GScalar sc;
105
+ cv::GMat mat_in1, mat_in2;
106
+
107
+ cv::GMat op_not = ~ mat_in1;
108
+
109
+ cv::GMat op_mat_mat1 = mat_in1 & mat_in2;
110
+ cv::GMat op_mat_mat2 = mat_in1 | mat_in2;
111
+ cv::GMat op_mat_mat3 = mat_in1 ^ mat_in2;
112
+ cv::GMat op_mat_mat4 = mat_in1 + mat_in2;
113
+ cv::GMat op_mat_mat5 = mat_in1 - mat_in2;
114
+ cv::GMat op_mat_mat6 = mat_in1 / mat_in2;
115
+ cv::GMat op_mat_mat7 = mat_in1 > mat_in2;
116
+ cv::GMat op_mat_mat8 = mat_in1 >= mat_in2;
117
+ cv::GMat op_mat_mat9 = mat_in1 < mat_in2;
118
+ cv::GMat op_mat_mat10 = mat_in1 <= mat_in2;
119
+ cv::GMat op_mat_mat11 = mat_in1 == mat_in2;
120
+ cv::GMat op_mat_mat12 = mat_in1 != mat_in2;
121
+
122
+ cv::GMat op_mat_sc1 = mat_in1 & sc;
123
+ cv::GMat op_mat_sc2 = mat_in1 | sc;
124
+ cv::GMat op_mat_sc3 = mat_in1 ^ sc;
125
+ cv::GMat op_mat_sc4 = mat_in1 + sc;
126
+ cv::GMat op_mat_sc5 = mat_in1 - sc;
127
+ cv::GMat op_mat_sc6 = mat_in1 * sc;
128
+ cv::GMat op_mat_sc7 = mat_in1 / sc;
129
+ cv::GMat op_mat_sc8 = mat_in1 > sc;
130
+ cv::GMat op_mat_sc9 = mat_in1 >= sc;
131
+ cv::GMat op_mat_sc10 = mat_in1 < sc;
132
+ cv::GMat op_mat_sc11 = mat_in1 <= sc;
133
+ cv::GMat op_mat_sc12 = mat_in1 == sc;
134
+ cv::GMat op_mat_sc13 = mat_in1 != sc;
135
+
136
+ cv::GMat op_sc_mat1 = sc & mat_in2;
137
+ cv::GMat op_sc_mat2 = sc | mat_in2;
138
+ cv::GMat op_sc_mat3 = sc ^ mat_in2;
139
+ cv::GMat op_sc_mat4 = sc + mat_in2;
140
+ cv::GMat op_sc_mat5 = sc - mat_in2;
141
+ cv::GMat op_sc_mat6 = sc * mat_in2;
142
+ cv::GMat op_sc_mat7 = sc / mat_in2;
143
+ cv::GMat op_sc_mat8 = sc > mat_in2;
144
+ cv::GMat op_sc_mat9 = sc >= mat_in2;
145
+ cv::GMat op_sc_mat10 = sc < mat_in2;
146
+ cv::GMat op_sc_mat11 = sc <= mat_in2;
147
+ cv::GMat op_sc_mat12 = sc == mat_in2;
148
+ cv::GMat op_sc_mat13 = sc != mat_in2;
149
+
150
+ cv::GMat mul_mat_float1 = mat_in1 * 1 .0f ;
151
+ cv::GMat mul_mat_float2 = 1 .0f * mat_in2;
152
+ // No compilation errors expected
153
+ }
154
+ } // for_test
80
155
} // opencv_test
81
156
82
157
#endif // OPENCV_GAPI_OPERATOR_TESTS_INL_COMMON_HPP
0 commit comments