Mercurial > hg > match-vamp
view test/TestDistanceMetric.cpp @ 131:57cda698c225 refactors
Start DistanceMetric test
author | Chris Cannam |
---|---|
date | Thu, 11 Dec 2014 13:55:25 +0000 |
parents | |
children | af69db43f5a4 |
line wrap: on
line source
#include "DistanceMetric.h" #include <vector> #include <iostream> #include <cmath> using namespace std; #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MAIN #include <boost/test/unit_test.hpp> static vector<double> getTestFeature(double m) { vector<double> f; double fd[] = { 0, 1, 2, 3 }; for (int i = 0; i < 4; ++i) { f.push_back(fd[i] * m); } return f; } BOOST_AUTO_TEST_SUITE(TestDistanceMetric) BOOST_AUTO_TEST_CASE(nonorm) { DistanceMetric dm(DistanceMetric::NoDistanceNormalisation); vector<double> e1 = getTestFeature(1), e2 = getTestFeature(2), e0 = getTestFeature(0); BOOST_CHECK_EQUAL(dm.calcDistance(e0, e0), 0.0); } BOOST_AUTO_TEST_SUITE_END()