Merge pull request #20922 from alexgiving:atrutnev/align_expect_assert_macros

GAPI: Align EXPECT/ASSERT macros

* Align TEST macros

* restart CI

* Fix ASSERT_GT in gapi_async_test
pull/20977/head
Trutnev Aleksei 3 years ago committed by GitHub
parent e70ba29d95
commit 6a73e5a720
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 56
      modules/gapi/test/common/gapi_core_tests_inl.hpp
  2. 80
      modules/gapi/test/common/gapi_imgproc_tests_inl.hpp
  3. 6
      modules/gapi/test/common/gapi_operators_tests_inl.hpp
  4. 16
      modules/gapi/test/gapi_opaque_tests.cpp
  5. 2
      modules/gapi/test/infer/gapi_infer_onnx_test.cpp
  6. 2
      modules/gapi/test/internal/gapi_int_gmetaarg_test.cpp
  7. 2
      modules/gapi/test/own/conc_queue_tests.cpp
  8. 2
      modules/gapi/test/own/last_written_value_tests.cpp
  9. 74
      modules/gapi/test/own/mat_tests.cpp
  10. 18
      modules/gapi/test/own/scalar_tests.cpp
  11. 4
      modules/gapi/test/streaming/gapi_streaming_tests.cpp
  12. 70
      modules/gapi/test/streaming/gapi_streaming_vpl_core_test.cpp
  13. 30
      modules/gapi/test/util/any_tests.cpp
  14. 42
      modules/gapi/test/util/variant_tests.cpp

@ -138,7 +138,7 @@ TEST_P(MathOpTest, MatricesAccuracyTest)
#else #else
EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF));
#endif #endif
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -173,7 +173,7 @@ TEST_P(MulDoubleTest, AccuracyTest)
#else #else
EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF));
#endif #endif
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
TEST_P(DivTest, DISABLED_DivByZeroTest) // https://github.com/opencv/opencv/pull/12826 TEST_P(DivTest, DISABLED_DivByZeroTest) // https://github.com/opencv/opencv/pull/12826
@ -195,7 +195,7 @@ TEST_P(DivTest, DISABLED_DivByZeroTest) // https://github.com/opencv/opencv/pul
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -304,7 +304,7 @@ TEST_P(Polar2CartTest, AccuracyTest)
// //
// TODO: Make threshold a configurable parameter of this test (ADE-221) // TODO: Make threshold a configurable parameter of this test (ADE-221)
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
cv::Mat &outx = out_mat_gapi, cv::Mat &outx = out_mat_gapi,
&outy = out_mat2; &outy = out_mat2;
@ -347,7 +347,7 @@ TEST_P(Cart2PolarTest, AccuracyTest)
// //
// TODO: Make threshold a configurable parameter of this test (ADE-221) // TODO: Make threshold a configurable parameter of this test (ADE-221)
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
cv::Mat &outm = out_mat_gapi, cv::Mat &outm = out_mat_gapi,
&outa = out_mat2; &outa = out_mat2;
@ -406,7 +406,7 @@ TEST_P(CmpTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
} }
} }
@ -464,7 +464,7 @@ TEST_P(BitwiseTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF));
} }
} }
@ -484,7 +484,7 @@ TEST_P(NotTest, AccuracyTest)
} }
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF));
} }
} }
@ -508,7 +508,7 @@ TEST_P(SelectTest, AccuracyTest)
} }
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF));
} }
} }
@ -528,7 +528,7 @@ TEST_P(MinTest, AccuracyTest)
} }
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF));
} }
} }
@ -548,7 +548,7 @@ TEST_P(MaxTest, AccuracyTest)
} }
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF));
} }
} }
@ -568,7 +568,7 @@ TEST_P(AbsDiffTest, AccuracyTest)
} }
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF));
} }
} }
@ -589,7 +589,7 @@ TEST_P(AbsDiffCTest, AccuracyTest)
} }
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF));
} }
} }
@ -659,7 +659,7 @@ TEST_P(AddWeightedTest, AccuracyTest)
} }
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
TEST_P(NormTest, AccuracyTest) TEST_P(NormTest, AccuracyTest)
@ -738,7 +738,7 @@ TEST_P(ThresholdTest, AccuracyTestBinary)
} }
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
EXPECT_EQ(0, cv::norm(out_mat_ocv, out_mat_gapi, NORM_L1)); EXPECT_EQ(0, cv::norm(out_mat_ocv, out_mat_gapi, NORM_L1));
} }
} }
@ -764,7 +764,7 @@ TEST_P(ThresholdOTTest, AccuracyTestOtsu)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
EXPECT_EQ(ocv_res, out_gapi_scalar.val[0]); EXPECT_EQ(ocv_res, out_gapi_scalar.val[0]);
} }
} }
@ -788,7 +788,7 @@ TEST_P(InRangeTest, AccuracyTest)
} }
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF));
} }
} }
@ -992,7 +992,7 @@ TEST_P(RemapTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -1011,7 +1011,7 @@ TEST_P(FlipTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -1037,7 +1037,7 @@ TEST_P(CropTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF));
EXPECT_EQ(out_mat_gapi.size(), sz_out); EXPECT_EQ(sz_out, out_mat_gapi.size());
} }
} }
@ -1063,7 +1063,7 @@ TEST_P(CopyTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF));
EXPECT_EQ(out_mat_gapi.size(), sz_out); EXPECT_EQ(sz_out, out_mat_gapi.size());
} }
} }
@ -1245,7 +1245,7 @@ TEST_P(LUTTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -1269,7 +1269,7 @@ TEST_P(ConvertToTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -1378,7 +1378,7 @@ TEST_P(NormalizeTest, Test)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -1654,7 +1654,7 @@ TEST_P(ReInitOutTest, TestWithAdd)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_gapi, out_mat_ocv, NORM_INF));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
}; };
// run for uninitialized output // run for uninitialized output
@ -1738,7 +1738,7 @@ TEST_P(SizeTest, ParseTest)
cv::GComputation c(cv::GIn(in), cv::GOut(out)); cv::GComputation c(cv::GIn(in), cv::GOut(out));
c.apply(cv::gin(in_mat1), cv::gout(out_sz), getCompileArgs()); c.apply(cv::gin(in_mat1), cv::gout(out_sz), getCompileArgs());
EXPECT_EQ(out_sz, sz); EXPECT_EQ(sz, out_sz);
} }
TEST_P(SizeRTest, ParseTest) TEST_P(SizeRTest, ParseTest)
@ -1751,7 +1751,7 @@ TEST_P(SizeRTest, ParseTest)
cv::GComputation c(cv::GIn(op_rect), cv::GOut(out)); cv::GComputation c(cv::GIn(op_rect), cv::GOut(out));
c.apply(cv::gin(rect), cv::gout(out_sz), getCompileArgs()); c.apply(cv::gin(rect), cv::gout(out_sz), getCompileArgs());
EXPECT_EQ(out_sz, sz); EXPECT_EQ(sz, out_sz);
} }
namespace { namespace {
@ -1784,7 +1784,7 @@ TEST_P(SizeMFTest, ParseTest)
cv::GComputation c(cv::GIn(in), cv::GOut(out)); cv::GComputation c(cv::GIn(in), cv::GOut(out));
c.apply(cv::gin(frame), cv::gout(out_sz), getCompileArgs()); c.apply(cv::gin(frame), cv::gout(out_sz), getCompileArgs());
EXPECT_EQ(out_sz, sz); EXPECT_EQ(sz, out_sz);
} }
} // opencv_test } // opencv_test

@ -92,7 +92,7 @@ TEST_P(Filter2DTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -116,7 +116,7 @@ TEST_P(BoxFilterTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -142,7 +142,7 @@ TEST_P(SepFilterTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -163,7 +163,7 @@ TEST_P(BlurTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -185,7 +185,7 @@ TEST_P(GaussianBlurTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -204,7 +204,7 @@ TEST_P(MedianBlurTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -225,7 +225,7 @@ TEST_P(ErodeTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -246,7 +246,7 @@ TEST_P(Erode3x3Test, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -267,7 +267,7 @@ TEST_P(DilateTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -288,7 +288,7 @@ TEST_P(Dilate3x3Test, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -311,7 +311,7 @@ TEST_P(MorphologyExTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -330,7 +330,7 @@ TEST_P(SobelTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -362,8 +362,8 @@ TEST_P(SobelXYTest, AccuracyTest)
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_TRUE(cmpF(out_mat_gapi2, out_mat_ocv2)); EXPECT_TRUE(cmpF(out_mat_gapi2, out_mat_ocv2));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
EXPECT_EQ(out_mat_gapi2.size(), sz); EXPECT_EQ(sz, out_mat_gapi2.size());
} }
} }
@ -383,7 +383,7 @@ TEST_P(LaplacianTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -402,7 +402,7 @@ TEST_P(BilateralFilterTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -421,7 +421,7 @@ TEST_P(EqHistTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -440,7 +440,7 @@ TEST_P(CannyTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -611,7 +611,7 @@ TEST_P(BGR2RGBTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -630,7 +630,7 @@ TEST_P(RGB2GrayTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -649,7 +649,7 @@ TEST_P(BGR2GrayTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -668,7 +668,7 @@ TEST_P(RGB2YUVTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -687,7 +687,7 @@ TEST_P(YUV2RGBTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -706,7 +706,7 @@ TEST_P(BGR2I420Test, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), Size(sz.width, sz.height * 3 / 2)); EXPECT_EQ(Size(sz.width, sz.height * 3 / 2), out_mat_gapi.size());
} }
} }
@ -725,7 +725,7 @@ TEST_P(RGB2I420Test, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), Size(sz.width, sz.height * 3 / 2)); EXPECT_EQ(Size(sz.width, sz.height * 3 / 2), out_mat_gapi.size());
} }
} }
@ -744,7 +744,7 @@ TEST_P(I4202BGRTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), Size(sz.width, sz.height * 2 / 3)); EXPECT_EQ(Size(sz.width, sz.height * 2 / 3), out_mat_gapi.size());
} }
} }
@ -763,7 +763,7 @@ TEST_P(I4202RGBTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), Size(sz.width, sz.height * 2 / 3)); EXPECT_EQ(Size(sz.width, sz.height * 2 / 3), out_mat_gapi.size());
} }
} }
@ -787,7 +787,7 @@ TEST_P(NV12toRGBTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -811,7 +811,7 @@ TEST_P(NV12toBGRTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -839,7 +839,7 @@ TEST_P(NV12toGrayTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -882,7 +882,7 @@ TEST_P(NV12toRGBpTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi_planar, out_mat_ocv_planar)); EXPECT_TRUE(cmpF(out_mat_gapi_planar, out_mat_ocv_planar));
EXPECT_EQ(out_mat_gapi_planar.size(), sz_p); EXPECT_EQ(sz_p, out_mat_gapi_planar.size());
} }
} }
@ -912,7 +912,7 @@ TEST_P(NV12toBGRpTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi_planar, out_mat_ocv_planar)); EXPECT_TRUE(cmpF(out_mat_gapi_planar, out_mat_ocv_planar));
EXPECT_EQ(out_mat_gapi_planar.size(), sz_p); EXPECT_EQ(sz_p, out_mat_gapi_planar.size());
} }
} }
@ -931,7 +931,7 @@ TEST_P(RGB2LabTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -950,7 +950,7 @@ TEST_P(BGR2LUVTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -969,7 +969,7 @@ TEST_P(LUV2BGRTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -988,7 +988,7 @@ TEST_P(BGR2YUVTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -1007,7 +1007,7 @@ TEST_P(YUV2BGRTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -1026,7 +1026,7 @@ TEST_P(RGB2HSVTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -1045,7 +1045,7 @@ TEST_P(BayerGR2RGBTest, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
@ -1064,7 +1064,7 @@ TEST_P(RGB2YUV422Test, AccuracyTest)
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
EXPECT_EQ(out_mat_gapi.size(), sz); EXPECT_EQ(sz, out_mat_gapi.size());
} }
} }
} // opencv_test } // opencv_test

@ -36,7 +36,7 @@ TEST_P(MathOperatorMatScalarTest, OperatorAccuracyTest )
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
} }
} }
@ -63,7 +63,7 @@ TEST_P(MathOperatorMatMatTest, OperatorAccuracyTest )
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv)); EXPECT_TRUE(cmpF(out_mat_gapi, out_mat_ocv));
} }
} }
@ -83,7 +83,7 @@ TEST_P(NotOperatorTest, OperatorAccuracyTest)
} }
// Comparison ////////////////////////////////////////////////////////////// // Comparison //////////////////////////////////////////////////////////////
{ {
ASSERT_EQ(out_mat_gapi.size(), sz); ASSERT_EQ(sz, out_mat_gapi.size());
EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF)); EXPECT_EQ(0, cvtest::norm(out_mat_ocv, out_mat_gapi, NORM_INF));
} }
} }

@ -161,7 +161,7 @@ TEST(GOpaque, TestOpaqueBetween)
c.apply(cv::gin(mat_in), cv::gout(mat_out), cv::compile_args(cv::gapi::kernels<OCVGeneratePoint, OCVPaintPoint>())); c.apply(cv::gin(mat_in), cv::gout(mat_out), cv::compile_args(cv::gapi::kernels<OCVGeneratePoint, OCVPaintPoint>()));
int painted = mat_out.at<uint8_t>(42, 42); int painted = mat_out.at<uint8_t>(42, 42);
EXPECT_EQ(painted, 77); EXPECT_EQ(77, painted);
} }
TEST(GOpaque, TestOpaqueBetweenIslands) TEST(GOpaque, TestOpaqueBetweenIslands)
@ -181,7 +181,7 @@ TEST(GOpaque, TestOpaqueBetweenIslands)
c.apply(cv::gin(mat_in), cv::gout(mat_out), cv::compile_args(cv::gapi::kernels<OCVGeneratePoint, OCVPaintPoint>())); c.apply(cv::gin(mat_in), cv::gout(mat_out), cv::compile_args(cv::gapi::kernels<OCVGeneratePoint, OCVPaintPoint>()));
int painted = mat_out.at<uint8_t>(42, 42); int painted = mat_out.at<uint8_t>(42, 42);
EXPECT_EQ(painted, 77); EXPECT_EQ(77, painted);
} }
TEST(GOpaque, TestOpaqueCustomOut2) TEST(GOpaque, TestOpaqueCustomOut2)
@ -200,11 +200,11 @@ TEST(GOpaque, TestOpaqueCustomOut2)
cv::GComputation c(cv::GIn(in1, in2), cv::GOut(std::get<0>(out), std::get<1>(out))); cv::GComputation c(cv::GIn(in1, in2), cv::GOut(std::get<0>(out), std::get<1>(out)));
c.apply(cv::gin(input1, input2), cv::gout(out1, out2), cv::compile_args(cv::gapi::kernels<OCVGenerateOpaque>())); c.apply(cv::gin(input1, input2), cv::gout(out1, out2), cv::compile_args(cv::gapi::kernels<OCVGenerateOpaque>()));
EXPECT_EQ(out1.num, input1.size().width * input1.size().height); EXPECT_EQ(input1.size().width * input1.size().height, out1.num);
EXPECT_EQ(out1.s, str); EXPECT_EQ(str, out1.s);
EXPECT_EQ(out2.num, input2.size().width * input2.size().height); EXPECT_EQ(input2.size().width * input2.size().height, out2.num);
EXPECT_EQ(out2.s, str2); EXPECT_EQ(str2, out2.s);
} }
TEST(GOpaque, TestOpaqueOCLBackendIn) TEST(GOpaque, TestOpaqueOCLBackendIn)
@ -220,7 +220,7 @@ TEST(GOpaque, TestOpaqueOCLBackendIn)
cv::compile_args(cv::gapi::kernels<OCLPaintPoint>())); cv::compile_args(cv::gapi::kernels<OCLPaintPoint>()));
int painted = mat_out.at<uint8_t>(42, 42); int painted = mat_out.at<uint8_t>(42, 42);
EXPECT_EQ(painted, 77); EXPECT_EQ(77, painted);
} }
TEST(GOpaque, TestOpaqueOCLBackendBetween) TEST(GOpaque, TestOpaqueOCLBackendBetween)
@ -240,7 +240,7 @@ TEST(GOpaque, TestOpaqueOCLBackendBetween)
cv::compile_args(cv::gapi::kernels<OCLGeneratePoint, OCLPaintPoint>())); cv::compile_args(cv::gapi::kernels<OCLGeneratePoint, OCLPaintPoint>()));
int painted = mat_out.at<uint8_t>(42, 42); int painted = mat_out.at<uint8_t>(42, 42);
EXPECT_EQ(painted, 77); EXPECT_EQ(77, painted);
} }
TEST(GOpaque, TestOpaqueOCLBackendOut) TEST(GOpaque, TestOpaqueOCLBackendOut)

@ -231,7 +231,7 @@ void remapToIESSDOut(const std::vector<cv::Mat> &detections,
} }
// SSD-MobilenetV1 structure check // SSD-MobilenetV1 structure check
ASSERT_EQ(detections[0].total(), 1u); ASSERT_EQ(1u, detections[0].total());
ASSERT_EQ(detections[2].total(), detections[0].total() * 100); ASSERT_EQ(detections[2].total(), detections[0].total() * 100);
ASSERT_EQ(detections[2].total(), detections[3].total()); ASSERT_EQ(detections[2].total(), detections[3].total());
ASSERT_EQ((detections[2].total() * 4), detections[1].total()); ASSERT_EQ((detections[2].total() * 4), detections[1].total());

@ -102,7 +102,7 @@ TEST(GMetaArg, Can_Get_Metas_From_Input_Run_Args)
GMatDesc m_desc; GMatDesc m_desc;
GMetaArgs meta_args = descr_of(cv::gin(m, s, v)); GMetaArgs meta_args = descr_of(cv::gin(m, s, v));
EXPECT_EQ(meta_args.size(), 3u); EXPECT_EQ(3u, meta_args.size());
EXPECT_NO_THROW(m_desc = util::get<cv::GMatDesc>(meta_args[0])); EXPECT_NO_THROW(m_desc = util::get<cv::GMatDesc>(meta_args[0]));
EXPECT_NO_THROW(util::get<cv::GScalarDesc>(meta_args[1])); EXPECT_NO_THROW(util::get<cv::GScalarDesc>(meta_args[1]));
EXPECT_NO_THROW(util::get<cv::GArrayDesc>(meta_args[2])); EXPECT_NO_THROW(util::get<cv::GArrayDesc>(meta_args[2]));

@ -27,7 +27,7 @@ TEST(ConcQueue, PushPop)
{ {
int x; int x;
q.pop(x); q.pop(x);
EXPECT_EQ(x, i); EXPECT_EQ(i, x);
} }
} }

@ -21,7 +21,7 @@ TEST(LastValue, PushPop) {
int x = 1; int x = 1;
v.pop(x); v.pop(x);
EXPECT_EQ(x, i); EXPECT_EQ(i, x);
} }
} }

@ -24,12 +24,12 @@ inline std::size_t multiply_dims(Dims const& dims){
TEST(OwnMat, DefaultConstruction) TEST(OwnMat, DefaultConstruction)
{ {
Mat m; Mat m;
ASSERT_EQ(m.data, nullptr); ASSERT_EQ(nullptr, m.data);
ASSERT_EQ(m.cols, 0); ASSERT_EQ(0, m.cols);
ASSERT_EQ(m.rows, 0); ASSERT_EQ(0, m.rows);
ASSERT_EQ(m.cols, 0); ASSERT_EQ(0, m.cols);
ASSERT_EQ(m.type(), 0); ASSERT_EQ(0, m.type());
ASSERT_EQ(m.depth(), 0); ASSERT_EQ(0, m.depth());
ASSERT_TRUE(m.dims.empty()); ASSERT_TRUE(m.dims.empty());
ASSERT_TRUE(m.empty()); ASSERT_TRUE(m.empty());
} }
@ -40,15 +40,15 @@ TEST(OwnMat, Create)
Mat m; Mat m;
m.create(size, CV_8UC1); m.create(size, CV_8UC1);
ASSERT_NE(m.data, nullptr); ASSERT_NE(nullptr, m.data);
ASSERT_EQ((cv::gapi::own::Size{m.cols, m.rows}), size); ASSERT_EQ(size, (cv::gapi::own::Size{m.cols, m.rows}));
ASSERT_EQ(m.total(), static_cast<size_t>(size.height) * size.width); ASSERT_EQ(static_cast<size_t>(size.height) * size.width, m.total());
ASSERT_EQ(m.type(), CV_8UC1); ASSERT_EQ(CV_8UC1, m.type());
ASSERT_EQ(m.depth(), CV_8U); ASSERT_EQ(CV_8U, m.depth());
ASSERT_EQ(m.channels(), 1); ASSERT_EQ(1, m.channels());
ASSERT_EQ(m.elemSize(), sizeof(uint8_t)); ASSERT_EQ(sizeof(uint8_t), m.elemSize());
ASSERT_EQ(m.step, sizeof(uint8_t) * m.cols); ASSERT_EQ(sizeof(uint8_t) * m.cols, m.step);
ASSERT_TRUE(m.dims.empty()); ASSERT_TRUE(m.dims.empty());
ASSERT_FALSE(m.empty()); ASSERT_FALSE(m.empty());
} }
@ -59,16 +59,16 @@ TEST(OwnMat, CreateND)
Mat m; Mat m;
m.create(dims, CV_32F); m.create(dims, CV_32F);
ASSERT_NE(nullptr , m.data ); ASSERT_NE(nullptr , m.data);
ASSERT_EQ((cv::gapi::own::Size{0,0}), (cv::gapi::own::Size{m.cols, m.rows})); ASSERT_EQ((cv::gapi::own::Size{0,0}), (cv::gapi::own::Size{m.cols, m.rows}));
ASSERT_EQ(multiply_dims(dims), m.total()); ASSERT_EQ(multiply_dims(dims), m.total());
ASSERT_EQ(CV_32F , m.type() ); ASSERT_EQ(CV_32F, m.type());
ASSERT_EQ(CV_32F , m.depth() ); ASSERT_EQ(CV_32F, m.depth());
ASSERT_EQ(-1 , m.channels()); ASSERT_EQ(-1, m.channels());
ASSERT_EQ(sizeof(float) , m.elemSize()); ASSERT_EQ(sizeof(float), m.elemSize());
ASSERT_EQ(0u , m.step ); ASSERT_EQ(0u, m.step);
ASSERT_EQ(dims , m.dims ); ASSERT_EQ(dims, m.dims);
ASSERT_FALSE(m.empty()); ASSERT_FALSE(m.empty());
} }
@ -78,15 +78,15 @@ TEST(OwnMat, CreateOverload)
Mat m; Mat m;
m.create(size.height,size.width, CV_8UC1); m.create(size.height,size.width, CV_8UC1);
ASSERT_NE(m.data, nullptr); ASSERT_NE(nullptr, m.data);
ASSERT_EQ((cv::Size{m.cols, m.rows}), size); ASSERT_EQ(size, (cv::Size{m.cols, m.rows}));
ASSERT_EQ(m.total(), static_cast<size_t>(size.height) * size.width); ASSERT_EQ(static_cast<size_t>(size.height) * size.width, m.total());
ASSERT_EQ(m.type(), CV_8UC1); ASSERT_EQ(CV_8UC1, m.type());
ASSERT_EQ(m.depth(), CV_8U); ASSERT_EQ(CV_8U, m.depth());
ASSERT_EQ(m.channels(), 1); ASSERT_EQ(1, m.channels());
ASSERT_EQ(m.elemSize(), sizeof(uint8_t)); ASSERT_EQ(sizeof(uint8_t), m.elemSize());
ASSERT_EQ(m.step, sizeof(uint8_t) * m.cols); ASSERT_EQ(sizeof(uint8_t) * m.cols, m.step);
ASSERT_TRUE(m.dims.empty()); ASSERT_TRUE(m.dims.empty());
ASSERT_FALSE(m.empty()); ASSERT_FALSE(m.empty());
} }
@ -97,14 +97,14 @@ TEST(OwnMat, Create3chan)
Mat m; Mat m;
m.create(size, CV_8UC3); m.create(size, CV_8UC3);
ASSERT_NE(m.data, nullptr); ASSERT_NE(nullptr, m.data);
ASSERT_EQ((cv::Size{m.cols, m.rows}), size); ASSERT_EQ(size, (cv::Size{m.cols, m.rows}));
ASSERT_EQ(m.type(), CV_8UC3); ASSERT_EQ(CV_8UC3, m.type());
ASSERT_EQ(m.depth(), CV_8U); ASSERT_EQ(CV_8U, m.depth());
ASSERT_EQ(m.channels(), 3); ASSERT_EQ(3, m.channels());
ASSERT_EQ(m.elemSize(), 3 * sizeof(uint8_t)); ASSERT_EQ(3 * sizeof(uint8_t), m.elemSize());
ASSERT_EQ(m.step, 3* sizeof(uint8_t) * m.cols); ASSERT_EQ(3 * sizeof(uint8_t) * m.cols, m.step);
ASSERT_TRUE(m.dims.empty()); ASSERT_TRUE(m.dims.empty());
ASSERT_FALSE(m.empty()); ASSERT_FALSE(m.empty());
} }
@ -134,7 +134,7 @@ namespace {
}; };
void ensure_mats_are_same(Mat const& copy, Mat const& m){ void ensure_mats_are_same(Mat const& copy, Mat const& m){
EXPECT_NE(copy.data, nullptr); EXPECT_NE(nullptr, copy.data);
EXPECT_EQ(state_of(copy), state_of(m)); EXPECT_EQ(state_of(copy), state_of(m));
} }
} }

@ -17,7 +17,7 @@ TEST(Scalar, CreateEmpty)
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
EXPECT_EQ(s[i], 0.0); EXPECT_EQ(0.0, s[i]);
} }
} }
@ -25,20 +25,20 @@ TEST(Scalar, CreateFromVal)
{ {
cv::gapi::own::Scalar s(5.0); cv::gapi::own::Scalar s(5.0);
EXPECT_EQ(s[0], 5.0); EXPECT_EQ(5.0, s[0]);
EXPECT_EQ(s[1], 0.0); EXPECT_EQ(0.0, s[1]);
EXPECT_EQ(s[2], 0.0); EXPECT_EQ(0.0, s[2]);
EXPECT_EQ(s[3], 0.0); EXPECT_EQ(0.0, s[3]);
} }
TEST(Scalar, CreateFromVals) TEST(Scalar, CreateFromVals)
{ {
cv::gapi::own::Scalar s(5.3, 3.3, 4.1, -2.0); cv::gapi::own::Scalar s(5.3, 3.3, 4.1, -2.0);
EXPECT_EQ(s[0], 5.3); EXPECT_EQ(5.3, s[0]);
EXPECT_EQ(s[1], 3.3); EXPECT_EQ(3.3, s[1]);
EXPECT_EQ(s[2], 4.1); EXPECT_EQ(4.1, s[2]);
EXPECT_EQ(s[3], -2.0); EXPECT_EQ(-2.0, s[3]);
} }
} // namespace opencv_test } // namespace opencv_test

@ -1130,7 +1130,7 @@ TEST_F(GAPI_Streaming_TemplateTypes, UnusedVectorIsOK)
} }
GAPI_Assert(out_mat || out_int); GAPI_Assert(out_mat || out_int);
if (out_int) { if (out_int) {
EXPECT_EQ( 3, out_int.value()); EXPECT_EQ(3, out_int.value());
} }
} }
} }
@ -1748,7 +1748,7 @@ TEST(GAPI_Streaming_Desync, MultipleDesyncOutputs_1) {
if (out_vec || out_int) { if (out_vec || out_int) {
EXPECT_EQ(320, out_vec.value()[0]); EXPECT_EQ(320, out_vec.value()[0]);
EXPECT_EQ(240, out_vec.value()[1]); EXPECT_EQ(240, out_vec.value()[1]);
EXPECT_EQ( 3, out_int.value()); EXPECT_EQ(3, out_int.value());
} }
} }
} }

@ -124,11 +124,11 @@ TEST(OneVPL_Source_Surface, InitSurface)
// check self consistency // check self consistency
EXPECT_EQ(reinterpret_cast<void*>(surf->get_handle()), EXPECT_EQ(reinterpret_cast<void*>(surf->get_handle()),
reinterpret_cast<void*>(mfx_core_handle)); reinterpret_cast<void*>(mfx_core_handle));
EXPECT_EQ(surf->get_locks_count(), 0); EXPECT_EQ(0, surf->get_locks_count());
EXPECT_EQ(surf->obtain_lock(), 0); EXPECT_EQ(0, surf->obtain_lock());
EXPECT_EQ(surf->get_locks_count(), 1); EXPECT_EQ(1, surf->get_locks_count());
EXPECT_EQ(surf->release_lock(), 1); EXPECT_EQ(1, surf->release_lock());
EXPECT_EQ(surf->get_locks_count(), 0); EXPECT_EQ(0, surf->get_locks_count());
} }
TEST(OneVPL_Source_Surface, ConcurrentLock) TEST(OneVPL_Source_Surface, ConcurrentLock)
@ -143,7 +143,7 @@ TEST(OneVPL_Source_Surface, ConcurrentLock)
auto surf = Surface::create_surface(std::move(handle), associated_memory); auto surf = Surface::create_surface(std::move(handle), associated_memory);
// check self consistency // check self consistency
EXPECT_EQ(surf->get_locks_count(), 0); EXPECT_EQ(0, surf->get_locks_count());
// MFX internal limitation: do not exceede U16 range // MFX internal limitation: do not exceede U16 range
// so I16 is using here // so I16 is using here
@ -168,7 +168,7 @@ TEST(OneVPL_Source_Surface, ConcurrentLock)
} }
worker_thread.join(); worker_thread.join();
EXPECT_EQ(surf->get_locks_count(), lock_counter * 2); EXPECT_EQ(lock_counter * 2, surf->get_locks_count());
} }
TEST(OneVPL_Source_Surface, MemoryLifeTime) TEST(OneVPL_Source_Surface, MemoryLifeTime)
@ -180,7 +180,7 @@ TEST(OneVPL_Source_Surface, MemoryLifeTime)
std::shared_ptr<void> associated_memory (preallocated_memory_ptr.get(), std::shared_ptr<void> associated_memory (preallocated_memory_ptr.get(),
[&preallocated_memory_ptr] (void* ptr) { [&preallocated_memory_ptr] (void* ptr) {
EXPECT_TRUE(preallocated_memory_ptr); EXPECT_TRUE(preallocated_memory_ptr);
EXPECT_EQ(preallocated_memory_ptr.get(), ptr); EXPECT_EQ(ptr, preallocated_memory_ptr.get());
preallocated_memory_ptr.reset(); preallocated_memory_ptr.reset();
}); });
@ -201,7 +201,7 @@ TEST(OneVPL_Source_Surface, MemoryLifeTime)
} }
// workspace memory must be alive // workspace memory must be alive
EXPECT_EQ(surfaces.size(), 0); EXPECT_EQ(0, surfaces.size());
EXPECT_TRUE(associated_memory != nullptr); EXPECT_TRUE(associated_memory != nullptr);
EXPECT_TRUE(preallocated_memory_ptr.get() != nullptr); EXPECT_TRUE(preallocated_memory_ptr.get() != nullptr);
@ -223,7 +223,7 @@ TEST(OneVPL_Source_Surface, MemoryLifeTime)
associated_memory.reset(); associated_memory.reset();
// workspace memory must be still alive // workspace memory must be still alive
EXPECT_EQ(surfaces.size(), 0); EXPECT_EQ(0, surfaces.size());
EXPECT_TRUE(associated_memory == nullptr); EXPECT_TRUE(associated_memory == nullptr);
EXPECT_TRUE(preallocated_memory_ptr.get() != nullptr); EXPECT_TRUE(preallocated_memory_ptr.get() != nullptr);
@ -246,13 +246,13 @@ TEST(OneVPL_Source_CPU_FrameAdapter, InitFrameAdapter)
auto surf = Surface::create_surface(std::move(handle), associated_memory); auto surf = Surface::create_surface(std::move(handle), associated_memory);
// check consistency // check consistency
EXPECT_EQ(surf->get_locks_count(), 0); EXPECT_EQ(0, surf->get_locks_count());
{ {
VPLMediaFrameCPUAdapter adapter(surf); VPLMediaFrameCPUAdapter adapter(surf);
EXPECT_EQ(surf->get_locks_count(), 1); EXPECT_EQ(1, surf->get_locks_count());
} }
EXPECT_EQ(surf->get_locks_count(), 0); EXPECT_EQ(0, surf->get_locks_count());
} }
TEST(OneVPL_Source_CPU_Accelerator, InitDestroy) TEST(OneVPL_Source_CPU_Accelerator, InitDestroy)
@ -276,8 +276,8 @@ TEST(OneVPL_Source_CPU_Accelerator, InitDestroy)
surface_size_bytes, surface_size_bytes,
create_test_surface); create_test_surface);
// check consistency // check consistency
EXPECT_EQ(acceleration_policy->get_surface_count(key), surface_count); EXPECT_EQ(surface_count, acceleration_policy->get_surface_count(key));
EXPECT_EQ(acceleration_policy->get_free_surface_count(key), surface_count); EXPECT_EQ(surface_count, acceleration_policy->get_free_surface_count(key));
pool_export_keys.push_back(key); pool_export_keys.push_back(key);
} }
@ -301,8 +301,8 @@ TEST(OneVPL_Source_CPU_Accelerator, PoolProduceConsume)
surface_size_bytes, surface_size_bytes,
create_test_surface); create_test_surface);
// check consistency // check consistency
EXPECT_EQ(acceleration_policy->get_surface_count(key), surface_count); EXPECT_EQ(surface_count, acceleration_policy->get_surface_count(key));
EXPECT_EQ(acceleration_policy->get_free_surface_count(key), surface_count); EXPECT_EQ(surface_count, acceleration_policy->get_free_surface_count(key));
// consume available surfaces // consume available surfaces
std::vector<std::shared_ptr<Surface>> surfaces; std::vector<std::shared_ptr<Surface>> surfaces;
@ -310,13 +310,13 @@ TEST(OneVPL_Source_CPU_Accelerator, PoolProduceConsume)
for (size_t i = 0; i < surface_count; i++) { for (size_t i = 0; i < surface_count; i++) {
std::shared_ptr<Surface> surf = acceleration_policy->get_free_surface(key).lock(); std::shared_ptr<Surface> surf = acceleration_policy->get_free_surface(key).lock();
EXPECT_TRUE(surf.get() != nullptr); EXPECT_TRUE(surf.get() != nullptr);
EXPECT_EQ(surf->obtain_lock(), 0); EXPECT_EQ(0, surf->obtain_lock());
surfaces.push_back(std::move(surf)); surfaces.push_back(std::move(surf));
} }
// check consistency (no free surfaces) // check consistency (no free surfaces)
EXPECT_EQ(acceleration_policy->get_surface_count(key), surface_count); EXPECT_EQ(acceleration_policy->get_surface_count(key), surface_count);
EXPECT_EQ(acceleration_policy->get_free_surface_count(key), 0); EXPECT_EQ(0, acceleration_policy->get_free_surface_count(key));
// fail consume non-free surfaces // fail consume non-free surfaces
for (size_t i = 0; i < surface_count; i++) { for (size_t i = 0; i < surface_count; i++) {
@ -325,19 +325,19 @@ TEST(OneVPL_Source_CPU_Accelerator, PoolProduceConsume)
// release surfaces // release surfaces
for (auto& surf : surfaces) { for (auto& surf : surfaces) {
EXPECT_EQ(surf->release_lock(), 1); EXPECT_EQ(1, surf->release_lock());
} }
surfaces.clear(); surfaces.clear();
// check consistency // check consistency
EXPECT_EQ(acceleration_policy->get_surface_count(key), surface_count); EXPECT_EQ(surface_count, acceleration_policy->get_surface_count(key));
EXPECT_EQ(acceleration_policy->get_free_surface_count(key), surface_count); EXPECT_EQ(surface_count, acceleration_policy->get_free_surface_count(key));
//check availability after release //check availability after release
for (size_t i = 0; i < surface_count; i++) { for (size_t i = 0; i < surface_count; i++) {
std::shared_ptr<Surface> surf = acceleration_policy->get_free_surface(key).lock(); std::shared_ptr<Surface> surf = acceleration_policy->get_free_surface(key).lock();
EXPECT_TRUE(surf.get() != nullptr); EXPECT_TRUE(surf.get() != nullptr);
EXPECT_EQ(surf->obtain_lock(), 0); EXPECT_EQ(0, surf->obtain_lock());
} }
} }
@ -358,8 +358,8 @@ TEST(OneVPL_Source_CPU_Accelerator, PoolProduceConcurrentConsume)
create_test_surface); create_test_surface);
// check consistency // check consistency
EXPECT_EQ(acceleration_policy->get_surface_count(key), surface_count); EXPECT_EQ(surface_count, acceleration_policy->get_surface_count(key));
EXPECT_EQ(acceleration_policy->get_free_surface_count(key), surface_count); EXPECT_EQ(surface_count, acceleration_policy->get_free_surface_count(key));
// consume available surfaces // consume available surfaces
std::vector<std::shared_ptr<Surface>> surfaces; std::vector<std::shared_ptr<Surface>> surfaces;
@ -367,7 +367,7 @@ TEST(OneVPL_Source_CPU_Accelerator, PoolProduceConcurrentConsume)
for (size_t i = 0; i < surface_count; i++) { for (size_t i = 0; i < surface_count; i++) {
std::shared_ptr<Surface> surf = acceleration_policy->get_free_surface(key).lock(); std::shared_ptr<Surface> surf = acceleration_policy->get_free_surface(key).lock();
EXPECT_TRUE(surf.get() != nullptr); EXPECT_TRUE(surf.get() != nullptr);
EXPECT_EQ(surf->obtain_lock(), 0); EXPECT_EQ(0, surf->obtain_lock());
surfaces.push_back(std::move(surf)); surfaces.push_back(std::move(surf));
} }
@ -381,7 +381,7 @@ TEST(OneVPL_Source_CPU_Accelerator, PoolProduceConcurrentConsume)
// concurrent release surfaces // concurrent release surfaces
size_t surfaces_count = surfaces.size(); size_t surfaces_count = surfaces.size();
for (auto& surf : surfaces) { for (auto& surf : surfaces) {
EXPECT_EQ(surf->release_lock(), 1); EXPECT_EQ(1, surf->release_lock());
std::this_thread::sleep_for(std::chrono::seconds(1)); std::this_thread::sleep_for(std::chrono::seconds(1));
} }
surfaces.clear(); surfaces.clear();
@ -415,28 +415,28 @@ TEST(OneVPL_Source_ProcessingEngine, Init)
mfxSession mfx_session{}; mfxSession mfx_session{};
engine.initialize_session(mfx_session, DecoderParams{}, std::shared_ptr<IDataProvider>{}); engine.initialize_session(mfx_session, DecoderParams{}, std::shared_ptr<IDataProvider>{});
EXPECT_EQ(engine.get_ready_frames_count(), 0); EXPECT_EQ(0, engine.get_ready_frames_count());
ProcessingEngineBase::ExecutionStatus ret = engine.process(mfx_session); ProcessingEngineBase::ExecutionStatus ret = engine.process(mfx_session);
EXPECT_EQ(ret, ProcessingEngineBase::ExecutionStatus::Continue); EXPECT_EQ(ret, ProcessingEngineBase::ExecutionStatus::Continue);
EXPECT_EQ(engine.pipeline_stage_num, 0); EXPECT_EQ(0, engine.pipeline_stage_num);
ret = engine.process(mfx_session); ret = engine.process(mfx_session);
EXPECT_EQ(ret, ProcessingEngineBase::ExecutionStatus::Continue); EXPECT_EQ(ret, ProcessingEngineBase::ExecutionStatus::Continue);
EXPECT_EQ(engine.pipeline_stage_num, 1); EXPECT_EQ(1, engine.pipeline_stage_num);
ret = engine.process(mfx_session); ret = engine.process(mfx_session);
EXPECT_EQ(ret, ProcessingEngineBase::ExecutionStatus::Continue); EXPECT_EQ(ret, ProcessingEngineBase::ExecutionStatus::Continue);
EXPECT_EQ(engine.pipeline_stage_num, 2); EXPECT_EQ(2, engine.pipeline_stage_num);
ret = engine.process(mfx_session); ret = engine.process(mfx_session);
EXPECT_EQ(ret, ProcessingEngineBase::ExecutionStatus::Processed); EXPECT_EQ(ret, ProcessingEngineBase::ExecutionStatus::Processed);
EXPECT_EQ(engine.pipeline_stage_num, 3); EXPECT_EQ(3, engine.pipeline_stage_num);
EXPECT_EQ(engine.get_ready_frames_count(), 1); EXPECT_EQ(1, engine.get_ready_frames_count());
ret = engine.process(mfx_session); ret = engine.process(mfx_session);
EXPECT_EQ(ret, ProcessingEngineBase::ExecutionStatus::SessionNotFound); EXPECT_EQ(ret, ProcessingEngineBase::ExecutionStatus::SessionNotFound);
EXPECT_EQ(engine.pipeline_stage_num, 3); EXPECT_EQ(3, engine.pipeline_stage_num);
EXPECT_EQ(engine.get_ready_frames_count(), 1); EXPECT_EQ(1, engine.get_ready_frames_count());
cv::gapi::wip::Data frame; cv::gapi::wip::Data frame;
engine.get_frame(frame); engine.get_frame(frame);

@ -17,10 +17,10 @@ TEST(Any, basic)
any a(8); any a(8);
auto casted_pointer = any_cast<int>(&a); auto casted_pointer = any_cast<int>(&a);
ASSERT_NE(nullptr, casted_pointer); ASSERT_NE(nullptr, casted_pointer);
ASSERT_EQ(*casted_pointer, 8); ASSERT_EQ(8, *casted_pointer);
*casted_pointer = 7; *casted_pointer = 7;
ASSERT_EQ(any_cast<int>(a), 7); ASSERT_EQ(7, any_cast<int>(a));
} }
TEST(Any, any_cast_ref_throws_on_empty) TEST(Any, any_cast_ref_throws_on_empty)
@ -36,13 +36,13 @@ TEST(Any, copy)
using namespace util; using namespace util;
any a(8); any a(8);
ASSERT_EQ(any_cast<int>(a), 8); ASSERT_EQ(8, any_cast<int>(a));
any b (a); any b (a);
ASSERT_NE(nullptr, any_cast<int>(&b)); ASSERT_NE(nullptr, any_cast<int>(&b));
ASSERT_EQ(8 , any_cast<int>(b)); ASSERT_EQ(8, any_cast<int>(b));
ASSERT_EQ(8 , any_cast<int>(a)); ASSERT_EQ(8, any_cast<int>(a));
} }
TEST(Any, copy_empty) TEST(Any, copy_empty)
@ -63,12 +63,12 @@ TEST(Any, move)
using namespace util; using namespace util;
any a(8); any a(8);
ASSERT_EQ(any_cast<int>(a), 8); ASSERT_EQ(8, any_cast<int>(a));
any b (std::move(a)); any b (std::move(a));
ASSERT_NE(nullptr, any_cast<int>(&b)); ASSERT_NE(nullptr, any_cast<int>(&b));
ASSERT_EQ(8 , any_cast<int>(b)); ASSERT_EQ(8, any_cast<int>(b));
ASSERT_EQ(nullptr, any_cast<int>(&a)); ASSERT_EQ(nullptr, any_cast<int>(&a));
} }
@ -93,12 +93,12 @@ TEST(Any, move_assign)
any a(8); any a(8);
any b; any b;
ASSERT_EQ(any_cast<int>(a), 8); ASSERT_EQ(8, any_cast<int>(a));
b = (std::move(a)); b = (std::move(a));
ASSERT_NE(nullptr, any_cast<int>(&b)); ASSERT_NE(nullptr, any_cast<int>(&b));
ASSERT_EQ(8 , any_cast<int>(b)); ASSERT_EQ(8, any_cast<int>(b));
ASSERT_EQ(nullptr, any_cast<int>(&a)); ASSERT_EQ(nullptr, any_cast<int>(&a));
} }
@ -108,14 +108,14 @@ TEST(Any, copy_assign)
any a(8); any a(8);
any b; any b;
ASSERT_EQ(any_cast<int>(a), 8); ASSERT_EQ(8, any_cast<int>(a));
ASSERT_EQ(nullptr, any_cast<int>(&b)); ASSERT_EQ(nullptr, any_cast<int>(&b));
b = a; b = a;
ASSERT_NE(nullptr, any_cast<int>(&b)); ASSERT_NE(nullptr, any_cast<int>(&b));
ASSERT_EQ(8 , any_cast<int>(b)); ASSERT_EQ(8, any_cast<int>(b));
ASSERT_EQ(8 , any_cast<int>(a)); ASSERT_EQ(8, any_cast<int>(a));
} }
TEST(Any, get_ref_to_val_from_any) TEST(Any, get_ref_to_val_from_any)
@ -125,7 +125,7 @@ TEST(Any, get_ref_to_val_from_any)
any a(x); any a(x);
int& casted_ref = any_cast<int>(a); int& casted_ref = any_cast<int>(a);
ASSERT_EQ(casted_ref, 8); ASSERT_EQ(8, casted_ref);
} }
TEST(Any, update_val_via_ref) TEST(Any, update_val_via_ref)
@ -134,9 +134,9 @@ TEST(Any, update_val_via_ref)
int x = 8; int x = 8;
any a(x); any a(x);
int& casted_ref = any_cast<int>(a); int& casted_ref = any_cast<int>(a);
ASSERT_EQ(casted_ref, 8); ASSERT_EQ(8, casted_ref);
casted_ref = 7; casted_ref = 7;
ASSERT_EQ(any_cast<int>(a), 7); ASSERT_EQ(7, any_cast<int>(a));
} }
} // namespace opencv_test } // namespace opencv_test

@ -587,34 +587,34 @@ TEST(Variant, DynamicVisitor)
test_validation::MyBoolParamIndexedVisitor visitor(ss); test_validation::MyBoolParamIndexedVisitor visitor(ss);
EXPECT_TRUE(cv::util::visit(visitor, var, int{42})); EXPECT_TRUE(cv::util::visit(visitor, var, int{42}));
EXPECT_EQ(ss.str(), std::string("0:42,")); EXPECT_EQ(std::string("0:42,"), ss.str());
} }
std::stringstream ss; std::stringstream ss;
test_validation::MyBoolNoParamNonIndexedVisitor visitor(ss); test_validation::MyBoolNoParamNonIndexedVisitor visitor(ss);
cv::util::visit(visitor, var); cv::util::visit(visitor, var);
EXPECT_EQ(ss.str(), std::string("0:42,")); EXPECT_EQ(std::string("0:42,"), ss.str());
var = double{1.0}; var = double{1.0};
EXPECT_TRUE(cv::util::visit(visitor, var)); EXPECT_TRUE(cv::util::visit(visitor, var));
EXPECT_EQ(ss.str(), std::string("0:42,1:1,")); EXPECT_EQ(std::string("0:42,1:1,"), ss.str());
var = char{'a'}; var = char{'a'};
EXPECT_TRUE(cv::util::visit(visitor, var)); EXPECT_TRUE(cv::util::visit(visitor, var));
EXPECT_EQ(ss.str(), std::string("0:42,1:1,2:a,")); EXPECT_EQ(std::string("0:42,1:1,2:a,"), ss.str());
var = float{6.0}; var = float{6.0};
EXPECT_TRUE(cv::util::visit(visitor, var)); EXPECT_TRUE(cv::util::visit(visitor, var));
EXPECT_EQ(ss.str(), std::string("0:42,1:1,2:a,3:6,")); EXPECT_EQ(std::string("0:42,1:1,2:a,3:6,"), ss.str());
var = test_validation::MyType{}; var = test_validation::MyType{};
EXPECT_TRUE(cv::util::visit(visitor, var)); EXPECT_TRUE(cv::util::visit(visitor, var));
EXPECT_EQ(ss.str(), std::string("0:42,1:1,2:a,3:6,4:MyType,")); EXPECT_EQ(std::string("0:42,1:1,2:a,3:6,4:MyType,"), ss.str());
var = test_validation::MyClass{}; var = test_validation::MyClass{};
EXPECT_TRUE(cv::util::visit(visitor, var)); EXPECT_TRUE(cv::util::visit(visitor, var));
EXPECT_EQ(ss.str(), std::string("0:42,1:1,2:a,3:6,4:MyType,5:MyClass,")); EXPECT_EQ(std::string("0:42,1:1,2:a,3:6,4:MyType,5:MyClass,"), ss.str());
} }
TEST(Variant, StaticVisitor) TEST(Variant, StaticVisitor)
@ -625,27 +625,27 @@ TEST(Variant, StaticVisitor)
test_validation::MyVoidNoParamNonIndexedVisitor visitor(ss); test_validation::MyVoidNoParamNonIndexedVisitor visitor(ss);
cv::util::visit(visitor, var); cv::util::visit(visitor, var);
EXPECT_EQ(ss.str(), std::string("42,")); EXPECT_EQ(std::string("42,"), ss.str());
var = double{1.0}; var = double{1.0};
cv::util::visit(visitor, var); cv::util::visit(visitor, var);
EXPECT_EQ(ss.str(), std::string("42,1,")); EXPECT_EQ(std::string("42,1,"), ss.str());
var = char{'a'}; var = char{'a'};
cv::util::visit(visitor, var); cv::util::visit(visitor, var);
EXPECT_EQ(ss.str(), std::string("42,1,a,")); EXPECT_EQ(std::string("42,1,a,"), ss.str());
var = float{6.0}; var = float{6.0};
cv::util::visit(visitor, var); cv::util::visit(visitor, var);
EXPECT_EQ(ss.str(), std::string("42,1,a,6,")); EXPECT_EQ(std::string("42,1,a,6,"), ss.str());
var = test_validation::MyType{}; var = test_validation::MyType{};
cv::util::visit(visitor, var); cv::util::visit(visitor, var);
EXPECT_EQ(ss.str(), std::string("42,1,a,6,MyType,")); EXPECT_EQ(std::string("42,1,a,6,MyType,"), ss.str());
var = test_validation::MyClass{}; var = test_validation::MyClass{};
cv::util::visit(visitor, var); cv::util::visit(visitor, var);
EXPECT_EQ(ss.str(), std::string("42,1,a,6,MyType,MyClass,")); EXPECT_EQ(std::string("42,1,a,6,MyType,MyClass,"), ss.str());
} }
TEST(Variant, StaticIndexedVisitor) TEST(Variant, StaticIndexedVisitor)
@ -655,27 +655,27 @@ TEST(Variant, StaticIndexedVisitor)
std::stringstream ss; std::stringstream ss;
cv::util::visit(test_validation::MyVoidNoParamIndexedVisitor {ss}, var); cv::util::visit(test_validation::MyVoidNoParamIndexedVisitor {ss}, var);
EXPECT_EQ(ss.str(), std::string("0:42,")); EXPECT_EQ(std::string("0:42,"), ss.str());
var = double{1.0}; var = double{1.0};
cv::util::visit(test_validation::MyVoidNoParamIndexedVisitor (ss), var); cv::util::visit(test_validation::MyVoidNoParamIndexedVisitor (ss), var);
EXPECT_EQ(ss.str(), std::string("0:42,1:1,")); EXPECT_EQ(std::string("0:42,1:1,"), ss.str());
var = char{'a'}; var = char{'a'};
cv::util::visit(test_validation::MyVoidNoParamIndexedVisitor (ss), var); cv::util::visit(test_validation::MyVoidNoParamIndexedVisitor (ss), var);
EXPECT_EQ(ss.str(), std::string("0:42,1:1,2:a,")); EXPECT_EQ(std::string("0:42,1:1,2:a,"), ss.str());
var = float{6.0}; var = float{6.0};
cv::util::visit(test_validation::MyVoidNoParamIndexedVisitor (ss), var); cv::util::visit(test_validation::MyVoidNoParamIndexedVisitor (ss), var);
EXPECT_EQ(ss.str(), std::string("0:42,1:1,2:a,3:6,")); EXPECT_EQ(std::string("0:42,1:1,2:a,3:6,"), ss.str());
var = test_validation::MyType{}; var = test_validation::MyType{};
cv::util::visit(test_validation::MyVoidNoParamIndexedVisitor (ss), var); cv::util::visit(test_validation::MyVoidNoParamIndexedVisitor (ss), var);
EXPECT_EQ(ss.str(), std::string("0:42,1:1,2:a,3:6,4:MyType,")); EXPECT_EQ(std::string("0:42,1:1,2:a,3:6,4:MyType,"), ss.str());
var = test_validation::MyClass{}; var = test_validation::MyClass{};
cv::util::visit(test_validation::MyVoidNoParamIndexedVisitor (ss), var); cv::util::visit(test_validation::MyVoidNoParamIndexedVisitor (ss), var);
EXPECT_EQ(ss.str(), std::string("0:42,1:1,2:a,3:6,4:MyType,5:MyClass,")); EXPECT_EQ(std::string("0:42,1:1,2:a,3:6,4:MyType,5:MyClass,"), ss.str());
} }
@ -686,7 +686,7 @@ TEST(Variant, LambdaVisitor)
{ {
cv::util::visit(cv::util::overload_lambdas( cv::util::visit(cv::util::overload_lambdas(
[](int value) { [](int value) {
EXPECT_EQ(value, 42); EXPECT_EQ(42, value);
}, },
[](double) { [](double) {
ADD_FAILURE() << "can't be called for `double`"; ADD_FAILURE() << "can't be called for `double`";
@ -719,7 +719,7 @@ TEST(Variant, LambdaVisitor)
ADD_FAILURE() << "can't be called for `double`"; ADD_FAILURE() << "can't be called for `double`";
}, },
[](char value) { [](char value) {
EXPECT_EQ(value, 'c'); EXPECT_EQ('c', value);
}, },
[](float) { [](float) {
ADD_FAILURE() << "can't be called for `float`"; ADD_FAILURE() << "can't be called for `float`";

Loading…
Cancel
Save