Mercurial > hg > nsaunier > traffic-intelligence
comparison c/test_feature.cpp @ 220:f0f800b95765
switched to Catch for the tests
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Thu, 21 Jun 2012 23:50:51 -0400 |
| parents | f7ddfc4aeb1e |
| children | b6ad86ee7033 |
comparison
equal
deleted
inserted
replaced
| 219:841a1714f702 | 220:f0f800b95765 |
|---|---|
| 1 #define BOOST_TEST_MODULE traffic intelligence | 1 #define CATCH_CONFIG_MAIN |
| 2 | 2 |
| 3 #include "Motion.hpp" | 3 #include "Motion.hpp" |
| 4 #include "testutils.hpp" | 4 #include "testutils.hpp" |
| 5 | 5 |
| 6 #include "opencv2/core/core.hpp" | 6 #include "opencv2/core/core.hpp" |
| 7 | 7 |
| 8 #include <boost/test/unit_test.hpp> | 8 #include "catch.hpp" |
| 9 #include <boost/test/floating_point_comparison.hpp> | |
| 10 | 9 |
| 11 using namespace std; | 10 using namespace std; |
| 12 using namespace cv; | 11 using namespace cv; |
| 13 | 12 |
| 14 BOOST_AUTO_TEST_SUITE(test_feature) | 13 TEST_CASE("features/similarity", "test feature similarity measure") { |
| 15 | |
| 16 BOOST_AUTO_TEST_CASE(feature_similarity) { | |
| 17 FeatureTrajectoryPtr ft1 = createFeatureTrajectory(1, 10, 20, Point2f(1,1), Point2f(0, 1)); | 14 FeatureTrajectoryPtr ft1 = createFeatureTrajectory(1, 10, 20, Point2f(1,1), Point2f(0, 1)); |
| 18 FeatureTrajectoryPtr ft2 = createFeatureTrajectory(2, 10, 20, Point2f(2,1), Point2f(0, 1)); | 15 FeatureTrajectoryPtr ft2 = createFeatureTrajectory(2, 10, 20, Point2f(2,1), Point2f(0, 1)); |
| 19 | 16 |
| 20 BOOST_CHECK(!ft1->minMaxSimilarity(*ft2, 10, 20, 0.5, 0.1)); | 17 REQUIRE_FALSE(ft1->minMaxSimilarity(*ft2, 10, 20, 0.5, 0.1)); |
| 21 BOOST_CHECK(ft1->minMaxSimilarity(*ft2, 10, 20, 1, 0.1)); | 18 REQUIRE(ft1->minMaxSimilarity(*ft2, 10, 20, 1, 0.1)); |
| 22 | 19 |
| 23 ft2 = createFeatureTrajectory(2, 10, 19, Point2f(1,1), Point2f(0, 1)); | 20 ft2 = createFeatureTrajectory(2, 10, 19, Point2f(1,1), Point2f(0, 1)); |
| 24 Mat homography; | 21 Mat homography; |
| 25 ft2->addPoint(20, Point2f(1,11.5), homography); | 22 ft2->addPoint(20, Point2f(1,11.5), homography); |
| 26 | 23 |
| 27 BOOST_CHECK(!ft1->minMaxSimilarity(*ft2, 10, 20, 0, 0.4)); | 24 REQUIRE_FALSE(ft1->minMaxSimilarity(*ft2, 10, 20, 0, 0.4)); |
| 28 BOOST_CHECK(ft1->minMaxSimilarity(*ft2, 10, 20, 0, 0.5)); | 25 REQUIRE(ft1->minMaxSimilarity(*ft2, 10, 20, 0, 0.5)); |
| 29 } | 26 } |
| 30 | |
| 31 BOOST_AUTO_TEST_SUITE_END() |
