Mercurial > hg > aimc
changeset 630:6a13139d4b71
Fix scons build of library and test.
Deleted main.cc since libgtest comes with a corresponding main library.
Everything compiles and the tests run on Ubuntu, but the tests all fail.
author | ronw@google.com |
---|---|
date | Thu, 23 May 2013 18:12:22 +0000 |
parents | 47c488dc7a01 |
children | af58e5d108fe |
files | carfac/SConstruct carfac/agc_coeffs.cc carfac/carfac.h carfac/carfac_test.cc carfac/carfac_test.h carfac/main.cc |
diffstat | 6 files changed, 12 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/carfac/SConstruct Thu May 23 17:25:15 2013 +0000 +++ b/carfac/SConstruct Thu May 23 18:12:22 2013 +0000 @@ -35,13 +35,16 @@ import os carfac_sources = [ + 'agc_coeffs.cc', 'agc_params.cc', + 'car_coeffs.cc', 'carfac.cc', 'carfac_common.cc', 'carfac_output.cc', 'car_params.cc', 'ear.cc', 'ear_output.cc', + 'ihc_coeffs.cc', 'ihc_params.cc', ] @@ -57,7 +60,7 @@ 'cd tmp && cmake . && make', ]) -env.Program(target = 'main', - source = ['main.cc'], - LIBS = ['carfac', 'sndfile', 'gtest', 'pthread'], +env.Program(target = 'carfac_test', + source = ['carfac_test.cc'], + LIBS = ['carfac', 'gtest', 'gtest_main', 'pthread'], LIBPATH = ['.', 'tmp'])
--- a/carfac/agc_coeffs.cc Thu May 23 17:25:15 2013 +0000 +++ b/carfac/agc_coeffs.cc Thu May 23 18:12:22 2013 +0000 @@ -106,8 +106,8 @@ fir_ok = fir[1] >= 0.1 ? true : false; break; default: - break; // Again, we've arrived at a bad n_taps in the design. - CHECK_EQ(5, n_taps) << "Bad n_taps; should be 3 or 5."; + assert(true && "Bad n_taps; should be 3 or 5."); + break; } } // Once we have the FIR design for this stage we can assign it to the
--- a/carfac/carfac.h Thu May 23 17:25:15 2013 +0000 +++ b/carfac/carfac.h Thu May 23 18:12:22 2013 +0000 @@ -72,4 +72,4 @@ FloatArray pole_freqs_; }; -#endif \ No newline at end of file +#endif
--- a/carfac/carfac_test.cc Thu May 23 17:25:15 2013 +0000 +++ b/carfac/carfac_test.cc Thu May 23 18:12:22 2013 +0000 @@ -21,6 +21,7 @@ // limitations under the License. #include "carfac_test.h" + // Three helper functions are defined here for loading the test data generated // by the Matlab version of CARFAC. // This loads one-dimensional FloatArrays from single-column text files. @@ -366,4 +367,4 @@ ear.agc_decimation(0)); } } -} \ No newline at end of file +}
--- a/carfac/carfac_test.h Thu May 23 17:25:15 2013 +0000 +++ b/carfac/carfac_test.h Thu May 23 18:12:22 2013 +0000 @@ -35,6 +35,6 @@ // when trying to build on a different system. #define TEST_SRC_DIR "/Users/alexbrandmeyer/aimc/carfac/test_data/" // Here we specify the level to which the output should match (10 decimals). -#define PRECISION_LEVEL 10.0e-11 +#define PRECISION_LEVEL 1.0e-10 #endif /* defined(__CARFAC_Open_Source_C___Library__carfac_test__) */
--- a/carfac/main.cc Thu May 23 17:25:15 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -// -// main.cc -// CARFAC Open Source C++ Library -// -// Created by Alex Brandmeyer on 5/10/13. -// -// This C++ file is part of an implementation of Lyon's cochlear model: -// "Cascade of Asymmetric Resonators with Fast-Acting Compression" -// to supplement Lyon's upcoming book "Human and Machine Hearing" -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ***************************************************************************** -// main.cc -// ***************************************************************************** -// This 'main' file is not currently intended as part of the CARFAC distribution -// but serves as a testbed for debugging and implementing various aspects of the -// library. I've currently tested the code on Mac OS X 10.8 using XCode. - -#include "carfac_test.h" - -// This 'main' function serves as the primary testbed for this C++ CARFAC -// implementation. The tests defined above are excuted by the 'RUN_ALL_TESTS()' -// function of the Google unit testing framework. -int main(int argc, char **argv) { - // This initializes the GoogleTest unit testing framework. - ::testing::InitGoogleTest(&argc, argv); - // This runs all of the tests that we've defined above. - return RUN_ALL_TESTS(); -}