summaryrefslogtreecommitdiff
path: root/tests/test_base.cpp
diff options
context:
space:
mode:
authorJohn Glover <j@johnglover.net>2013-06-07 13:00:55 +0200
committerJohn Glover <j@johnglover.net>2013-06-07 13:00:55 +0200
commitd60bbc935a1c7137c766792bf569ea7d6800fba9 (patch)
tree2247eb781e2b2f28a1f13253517b2c5eed11a3ae /tests/test_base.cpp
parentd91fc3a5b7b9d7a4ca85882b029fefe2c8daa156 (diff)
downloadsimpl-d60bbc935a1c7137c766792bf569ea7d6800fba9.tar.gz
simpl-d60bbc935a1c7137c766792bf569ea7d6800fba9.tar.bz2
simpl-d60bbc935a1c7137c766792bf569ea7d6800fba9.zip
Fix memory leaks in peak detection processes
Diffstat (limited to 'tests/test_base.cpp')
-rw-r--r--tests/test_base.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/tests/test_base.cpp b/tests/test_base.cpp
index b5f3acf..1a0816f 100644
--- a/tests/test_base.cpp
+++ b/tests/test_base.cpp
@@ -47,16 +47,12 @@ void TestFrame::test_max_partials() {
}
void TestFrame::test_add_peak() {
- Peak p = Peak();
- p.amplitude = 1.5;
- frame->add_peak(&p);
+ frame->add_peak(1.5, 220, 0, 0);
CPPUNIT_ASSERT(frame->max_peaks() == 100);
CPPUNIT_ASSERT(frame->num_peaks() == 1);
CPPUNIT_ASSERT_DOUBLES_EQUAL(1.5, frame->peak(0)->amplitude, PRECISION);
- Peak p2 = Peak();
- p2.amplitude = 2.0;
- frame->add_peak(&p2);
+ frame->add_peak(2.0, 440, 0, 0);
CPPUNIT_ASSERT(frame->max_peaks() == 100);
CPPUNIT_ASSERT(frame->num_peaks() == 2);
CPPUNIT_ASSERT_DOUBLES_EQUAL(2.0, frame->peak(1)->amplitude, PRECISION);
@@ -65,9 +61,7 @@ void TestFrame::test_add_peak() {
}
void TestFrame::test_clear() {
- Peak p = Peak();
- p.amplitude = 1.5;
- frame->add_peak(&p);
+ frame->add_peak(1.5, 220, 0, 0);
CPPUNIT_ASSERT(frame->num_peaks() == 1);
frame->clear();
CPPUNIT_ASSERT(frame->num_peaks() == 0);