-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new test which tests for bad frequency input from the user.
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "Iir.h" | ||
|
||
#include <stdio.h> | ||
|
||
#include "assert_print.h" | ||
|
||
int main (int,char**) | ||
{ | ||
// dummy filter parameters | ||
const float samplingrate = 1000; | ||
const float bw = 5; | ||
|
||
try { | ||
Iir::Butterworth::LowPass<3> f; | ||
f.setup (samplingrate, samplingrate / 2); | ||
assert_print(0,"No exception thrown by LowPass."); | ||
} catch ( const std::invalid_argument& e ) { | ||
fprintf(stderr,"Correct lowpass exception thrown for fc = fs/2: %s\n",e.what()); | ||
} | ||
|
||
try { | ||
Iir::Butterworth::HighPass<3> f; | ||
f.setup (samplingrate, samplingrate / 2); | ||
assert_print(0,"No exception thrown by HighPass."); | ||
} catch ( const std::invalid_argument& e ) { | ||
fprintf(stderr,"Correct highpass exception thrown for fc = fs/2: %s\n",e.what()); | ||
} | ||
|
||
try { | ||
Iir::Butterworth::BandStop<3> f; | ||
f.setup (samplingrate, samplingrate / 2, bw); | ||
assert_print(0,"No exception thrown by BandStop."); | ||
} catch ( const std::invalid_argument& e ) { | ||
fprintf(stderr,"Correct bandstop exception thrown for fc = fs/2: %s\n",e.what()); | ||
} | ||
|
||
try { | ||
Iir::Butterworth::BandPass<3> f; | ||
f.setup (samplingrate, samplingrate / 2, bw); | ||
assert_print(0,"No exception thrown by BandPass."); | ||
} catch ( const std::invalid_argument& e ) { | ||
fprintf(stderr,"Correct bandpass exception thrown for fc = fs/2: %s\n",e.what()); | ||
} | ||
|
||
return 0; | ||
} |