annotate test/TestCQKernel.cpp @ 196:da283326bcd3 tip master

Update plugin versions in RDF
author Chris Cannam <cannam@all-day-breakfast.com>
date Fri, 28 Feb 2020 09:43:02 +0000
parents c66f0f78b315
children
rev   line source
c@142 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
c@142 2
c@142 3 #include "cq/CQKernel.h"
c@142 4
c@142 5 #include <cmath>
c@142 6 #include <vector>
c@142 7 #include <iostream>
c@142 8
c@142 9 using std::vector;
c@142 10 using std::cerr;
c@142 11 using std::endl;
c@142 12
c@142 13 #define BOOST_TEST_DYN_LINK
c@142 14 #define BOOST_TEST_MAIN
c@142 15
c@142 16 #include <boost/test/unit_test.hpp>
c@142 17
c@143 18 static int rate = 123;
c@143 19 static int max = 60;
c@143 20 static int min = 12;
c@143 21 static int bpo = 4;
c@143 22
c@142 23 BOOST_AUTO_TEST_SUITE(TestCQKernel)
c@142 24
c@142 25 // Just some simple tests on kernel construction -- make sure it's the
c@142 26 // right size, etc
c@142 27
c@143 28 BOOST_AUTO_TEST_CASE(sampleRate) {
c@143 29 CQParameters params(rate, min, max, bpo);
c@142 30 CQKernel k(params);
c@143 31 BOOST_CHECK_EQUAL(k.getProperties().sampleRate, rate);
c@143 32 }
c@143 33
c@143 34 BOOST_AUTO_TEST_CASE(binsPerOctave) {
c@143 35 CQParameters params(rate, min, max, bpo);
c@143 36 CQKernel k(params);
c@143 37 BOOST_CHECK_EQUAL(k.getProperties().binsPerOctave, bpo);
c@143 38 }
c@143 39
c@143 40 BOOST_AUTO_TEST_CASE(maxFrequency) {
c@143 41 CQParameters params(rate, min, max, bpo);
c@143 42 CQKernel k(params);
c@143 43 BOOST_CHECK_EQUAL(k.getProperties().maxFrequency, max);
c@143 44 }
c@143 45
c@143 46 BOOST_AUTO_TEST_CASE(minFrequency) {
c@143 47 CQParameters params(rate, min, max, bpo);
c@143 48 CQKernel k(params);
c@143 49 BOOST_CHECK_CLOSE(k.getProperties().minFrequency,
c@143 50 (max / 2.0) * pow(2, 1.0/bpo),
c@143 51 1e-8);
c@143 52 }
c@143 53
c@143 54 BOOST_AUTO_TEST_CASE(atomsPerFrame) {
c@143 55 CQParameters params(rate, min, max, bpo);
c@143 56 CQKernel k(params);
c@143 57 BOOST_CHECK_EQUAL(k.getProperties().atomsPerFrame, 5);
c@143 58 }
c@143 59
c@143 60 BOOST_AUTO_TEST_CASE(fftSize) {
c@143 61 CQParameters params(rate, min, max, bpo);
c@143 62 CQKernel k(params);
c@143 63 BOOST_CHECK_EQUAL(k.getProperties().fftSize, 32);
c@142 64 }
c@142 65
c@142 66 BOOST_AUTO_TEST_SUITE_END()
c@142 67