forked from zchrissirhcz/cmake_examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestbed.cpp
More file actions
40 lines (29 loc) · 995 Bytes
/
testbed.cpp
File metadata and controls
40 lines (29 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <gtest/gtest.h>
#include <string>
TEST(OpenCV, read_image)
{
std::string image_path = "hello.jpg";
cv::Mat image = cv::imread(image_path);
EXPECT_TRUE(image.empty()==false);
}
TEST(OpenCV, cvtColor)
{
std::string image_path = "hello.jpg";
cv::Mat bgr = cv::imread(image_path);
ASSERT_TRUE(!bgr.empty());
cv::Mat gray;
cv::cvtColor(bgr, gray, cv::COLOR_BGR2GRAY);
EXPECT_TRUE(gray.size()==bgr.size());
}
int main(int argc, char* argv[])
{
testing::InitGoogleTest(&argc, argv);
// Run a specific test only
//testing::GTEST_FLAG(filter) = "MyLibrary.TestReading"; // I'm testing a new feature, run something quickly
testing::GTEST_FLAG(filter) = "OpenCV.read_image";
// Exclude a specific test
//testing::GTEST_FLAG(filter) = "-cvtColorTwoPlane.yuv420sp_to_rgb:-cvtColorTwoPlane.rgb_to_yuv420sp"; // The writing test is broken, so skip it
return RUN_ALL_TESTS();
}