test_location.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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. #include "test_precomp.hpp"
  5. namespace opencv_test { namespace {
  6. /**
  7. * Tests whether the `CVVISUAL_LOCATION` macro (from /include/opencv2/call_meta_data.hpp)
  8. * works as expected, i.e. the instance of `cvv::impl::CallMetaData` as which it gets defined has the correct data.
  9. * The second test in this file checks wether a `cvv::impl::CallMataData` created by hand and with an empty
  10. * initializer list has no known location, as it is supposed to be.
  11. */
  12. TEST(LocationTest, FileLineFunction)
  13. {
  14. auto locationMacroResult = CVVISUAL_LOCATION;
  15. size_t line = __LINE__ - 1;
  16. auto file = __FILE__;
  17. auto fun = CV_Func;
  18. EXPECT_EQ(locationMacroResult.isKnown, true);
  19. EXPECT_EQ(locationMacroResult.file, file);
  20. EXPECT_EQ(locationMacroResult.line, line);
  21. EXPECT_EQ(locationMacroResult.function, fun);
  22. }
  23. TEST(LocationTest, EmptyLocation)
  24. {
  25. cvv::impl::CallMetaData loc{};
  26. EXPECT_EQ(loc.isKnown, false);
  27. }
  28. }} // namespace