scalar_tests.cpp 859 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 Intel Corporation
  6. #include "../test_precomp.hpp"
  7. #include <opencv2/gapi/own/scalar.hpp>
  8. namespace opencv_test
  9. {
  10. TEST(Scalar, CreateEmpty)
  11. {
  12. cv::gapi::own::Scalar s;
  13. for (int i = 0; i < 4; ++i)
  14. {
  15. EXPECT_EQ(0.0, s[i]);
  16. }
  17. }
  18. TEST(Scalar, CreateFromVal)
  19. {
  20. cv::gapi::own::Scalar s(5.0);
  21. EXPECT_EQ(5.0, s[0]);
  22. EXPECT_EQ(0.0, s[1]);
  23. EXPECT_EQ(0.0, s[2]);
  24. EXPECT_EQ(0.0, s[3]);
  25. }
  26. TEST(Scalar, CreateFromVals)
  27. {
  28. cv::gapi::own::Scalar s(5.3, 3.3, 4.1, -2.0);
  29. EXPECT_EQ(5.3, s[0]);
  30. EXPECT_EQ(3.3, s[1]);
  31. EXPECT_EQ(4.1, s[2]);
  32. EXPECT_EQ(-2.0, s[3]);
  33. }
  34. } // namespace opencv_test