-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Define input and output level calibration functionality for…
… `DSP` (#121) * Start up some basic testing * Implement input & output level functionality * Add main test runner to workflow
- Loading branch information
1 parent
14348a9
commit 896352c
Showing
5 changed files
with
100 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
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,19 @@ | ||
// Entry point for tests | ||
|
||
#include <iostream> | ||
#include "test/test_dsp.cpp" | ||
|
||
int main() { | ||
std::cout << "Running tests..." << std::endl; | ||
// TODO Automatically loop, catch exceptions, log results | ||
test_dsp::test_construct(); | ||
test_dsp::test_get_input_level(); | ||
test_dsp::test_get_output_level(); | ||
test_dsp::test_has_input_level(); | ||
test_dsp::test_has_output_level(); | ||
test_dsp::test_set_input_level(); | ||
test_dsp::test_set_output_level(); | ||
|
||
std::cout << "Success!" << std::endl; | ||
return 0; | ||
} |
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,59 @@ | ||
// Tests for dsp | ||
|
||
#include "NAM/dsp.h" | ||
|
||
namespace test_dsp { | ||
// Simplest test: can I construct something! | ||
void test_construct() { | ||
nam::DSP myDsp(48000.0); | ||
} | ||
|
||
void test_get_input_level() { | ||
nam::DSP myDsp(48000.0); | ||
const double expected = 19.3; | ||
myDsp.SetInputLevel(expected); | ||
assert(myDsp.HasInputLevel()); | ||
const double actual = myDsp.GetInputLevel(); | ||
|
||
assert(actual == expected); | ||
} | ||
|
||
void test_get_output_level() { | ||
nam::DSP myDsp(48000.0); | ||
const double expected = 12.3; | ||
myDsp.SetOutputLevel(expected); | ||
assert(myDsp.HasOutputLevel()); | ||
const double actual = myDsp.GetOutputLevel(); | ||
|
||
assert(actual == expected); | ||
} | ||
|
||
// Test correct function of DSP::HasInputLevel() | ||
void test_has_input_level() { | ||
nam::DSP myDsp(48000.0); | ||
assert(!myDsp.HasInputLevel()); | ||
|
||
myDsp.SetInputLevel(19.3); | ||
assert(myDsp.HasInputLevel()); | ||
} | ||
|
||
void test_has_output_level() { | ||
nam::DSP myDsp(48000.0); | ||
assert(!myDsp.HasOutputLevel()); | ||
|
||
myDsp.SetOutputLevel(12.3); | ||
assert(myDsp.HasOutputLevel()); | ||
} | ||
|
||
// Test correct function of DSP::HasInputLevel() | ||
void test_set_input_level() { | ||
nam::DSP myDsp(48000.0); | ||
myDsp.SetInputLevel(19.3); | ||
} | ||
|
||
void test_set_output_level() { | ||
nam::DSP myDsp(48000.0); | ||
myDsp.SetOutputLevel(19.3); | ||
} | ||
}; | ||
|