annotate branches/carfac_cpp/unittest/CARFAC_unittest.cpp @ 706:f8e90b5d85fd tip

Delete CARFAC code from this repository. It has been moved to https://github.com/google/carfac Please email me with your github username to get access. I've also created a new mailing list to discuss CARFAC development: https://groups.google.com/forum/#!forum/carfac-dev
author ronw@google.com
date Thu, 18 Jul 2013 20:56:51 +0000
parents d59c0d65624b
children
rev   line source
Ulf@564 1 #include "CARFAC.h"
Ulf@564 2 #include "CARFAC_common.h"
Ulf@564 3 #include "gtest/gtest.h"
Ulf@564 4
Ulf@564 5 /*
Ulf@564 6 * CARFACDesignTest - Test suite for constructor related tests.
Ulf@564 7 */
Ulf@564 8 TEST(CARFACDesignTest, SampleRate) {
Ulf@586 9 CAR_parameters car_params = CAR_parameters();
Ulf@586 10 IHC_parameters ihc_params = IHC_parameters();
Ulf@586 11 AGC_parameters agc_params = AGC_parameters();
Ulf@564 12
Ulf@564 13 int arbitrary_number = 1347;
Ulf@564 14
Ulf@586 15 CARFAC fooCarfac = CARFAC(arbitrary_number, &car_params, &ihc_params, &agc_params, 1);
Ulf@586 16 EXPECT_EQ(fooCarfac.fs_, arbitrary_number);
Ulf@564 17 }
Ulf@564 18
Ulf@564 19 TEST(CARFACDesignTest, NumberOfEars) {
Ulf@586 20 CAR_parameters car_params = CAR_parameters();
Ulf@586 21 IHC_parameters ihc_params = IHC_parameters();
Ulf@586 22 AGC_parameters agc_params = AGC_parameters();
Ulf@564 23
Ulf@587 24 CARFAC fooCarfac = CARFAC(kDefaultFs, &car_params, &ihc_params, &agc_params, 2);
Ulf@586 25 EXPECT_EQ(fooCarfac.n_ears_, fooCarfac.ears_.size());
Ulf@564 26 }
Ulf@586 27
Ulf@586 28 TEST(CARFACDesignTest, MaxChannelsPerOctave) {
Ulf@586 29 CAR_parameters car_params = CAR_parameters();
Ulf@586 30 IHC_parameters ihc_params = IHC_parameters();
Ulf@586 31 AGC_parameters agc_params = AGC_parameters();
Ulf@586 32
Ulf@586 33 car_params.erb_per_step_ = 2*0.5; //not sure if this is the best way to design this test... I'm just doing _something_ here.
Ulf@586 34 float expected_max_channels_per_octave = 10.56/2;
Ulf@586 35 float tolerance = 0.25;
Ulf@586 36
Ulf@587 37 CARFAC fooCarfac = CARFAC(kDefaultFs, &car_params, &ihc_params, &agc_params, 1);
Ulf@586 38 ASSERT_NEAR(fooCarfac.max_channels_per_octave_, expected_max_channels_per_octave, tolerance);
Ulf@586 39 }