diff options
author | RJ Ryan <rryan@mixxx.org> | 2017-01-02 12:37:11 -0800 |
---|---|---|
committer | RJ Ryan <rryan@mixxx.org> | 2017-01-02 12:37:11 -0800 |
commit | dc9a13e3c76f730db9dd83ed2415bb1c232b119a (patch) | |
tree | 368f615d02c04fd6428376c15ed176af10253fa7 /src | |
parent | 72ca127077031206e44e47447e6985f59d1217b3 (diff) |
Clean up tests.
* Delete unused fixtures and empty TearDown/SetUp methods.
* Declare TearDown/SetUp override.
* Use std::make_unique in many places (fixing some leaks and replacing QScopedPointer).
Diffstat (limited to 'src')
38 files changed, 251 insertions, 489 deletions
diff --git a/src/test/analyserwaveformtest.cpp b/src/test/analyserwaveformtest.cpp index 5b19da1caf..f94391e2a1 100644 --- a/src/test/analyserwaveformtest.cpp +++ b/src/test/analyserwaveformtest.cpp @@ -15,7 +15,7 @@ namespace { class AnalyzerWaveformTest: public MixxxTest { protected: - virtual void SetUp() { + void SetUp() override { aw = new AnalyzerWaveform(config()); tio = Track::newTemporary(); tio->setSampleRate(44100); @@ -36,7 +36,7 @@ class AnalyzerWaveformTest: public MixxxTest { canaryBigBuf[i] = CANARY_FLOAT; } - virtual void TearDown() { + void TearDown() override { delete aw; delete [] bigbuf; delete [] canaryBigBuf; diff --git a/src/test/audiotaperpot_test.cpp b/src/test/audiotaperpot_test.cpp index 0819c5e1d7..cd312f320d 100644 --- a/src/test/audiotaperpot_test.cpp +++ b/src/test/audiotaperpot_test.cpp @@ -7,80 +7,69 @@ #include "control/controlobject.h" #include "util/math.h" -class AudioTaperPotTest : public MixxxTest { - public: - AudioTaperPotTest() { - } - - protected: - virtual void SetUp() { - } -}; +class AudioTaperPotTest : public MixxxTest {}; TEST_F(AudioTaperPotTest, ScaleTest) { { const double minDB = -6; const double maxDB = 6; const double neutralParameter = 0.5; - ControlAudioTaperPotBehavior* catpb = new ControlAudioTaperPotBehavior(minDB, maxDB, neutralParameter); + ControlAudioTaperPotBehavior catpb(minDB, maxDB, neutralParameter); // Parameter 0 is always 0 (-Infinity) - ASSERT_EQ(0.0, catpb->parameterToValue(0)); + ASSERT_EQ(0.0, catpb.parameterToValue(0)); // Parameter 0 is always 0 (-Infinity) - ASSERT_EQ(1.0, catpb->parameterToValue(neutralParameter)); + ASSERT_EQ(1.0, catpb.parameterToValue(neutralParameter)); // Parameter 1 is always maxDB - ASSERT_EQ(db2ratio(maxDB), catpb->parameterToValue(1)); + ASSERT_EQ(db2ratio(maxDB), catpb.parameterToValue(1)); // value 1 is always on a Integer midi value - double neutralMidi = catpb->valueToMidiParameter(1); + double neutralMidi = catpb.valueToMidiParameter(1); ASSERT_EQ(0.0, fmod(neutralMidi, 1)); // Midi value 64 should result in 0,5 - ASSERT_EQ(neutralParameter, catpb->midiValueToParameter(neutralMidi)); + ASSERT_EQ(neutralParameter, catpb.midiValueToParameter(neutralMidi)); // roundtrip check - ASSERT_DOUBLE_EQ(0.25, catpb->parameterToValue(catpb->midiValueToParameter(catpb->valueToMidiParameter(0.25)))); - ASSERT_DOUBLE_EQ(0.75, catpb->parameterToValue(catpb->midiValueToParameter(catpb->valueToMidiParameter(0.75)))); - delete catpb; + ASSERT_DOUBLE_EQ(0.25, catpb.parameterToValue(catpb.midiValueToParameter(catpb.valueToMidiParameter(0.25)))); + ASSERT_DOUBLE_EQ(0.75, catpb.parameterToValue(catpb.midiValueToParameter(catpb.valueToMidiParameter(0.75)))); } { const double minDB = 0; const double maxDB = 6; const double neutralParameter = 0.5; - ControlAudioTaperPotBehavior* catpb = new ControlAudioTaperPotBehavior(minDB, maxDB, neutralParameter); + ControlAudioTaperPotBehavior catpb(minDB, maxDB, neutralParameter); // Parameter 0 is always 0 (-Infinity) - ASSERT_EQ(0.0, catpb->parameterToValue(0)); + ASSERT_EQ(0.0, catpb.parameterToValue(0)); // Parameter 0 is always 0 (-Infinity) - ASSERT_EQ(1.0, catpb->parameterToValue(neutralParameter)); + ASSERT_EQ(1.0, catpb.parameterToValue(neutralParameter)); // Parameter 1 is always maxDB - ASSERT_EQ(db2ratio(maxDB), catpb->parameterToValue(1)); + ASSERT_EQ(db2ratio(maxDB), catpb.parameterToValue(1)); // value 1 is always on a Integer midi value - double neutralMidi = catpb->valueToMidiParameter(1); + double neutralMidi = catpb.valueToMidiParameter(1); ASSERT_EQ(0.0, fmod(neutralMidi, 1)); // Midi value 64 should result in 0,5 - ASSERT_EQ(neutralParameter, catpb->midiValueToParameter(neutralMidi)); + ASSERT_EQ(neutralParameter, catpb.midiValueToParameter(neutralMidi)); // roundtrip check - ASSERT_DOUBLE_EQ(0.25, catpb->parameterToValue(catpb->midiValueToParameter(catpb->valueToMidiParameter(0.25)))); - ASSERT_DOUBLE_EQ(0.75, catpb->parameterToValue(catpb->midiValueToParameter(catpb->valueToMidiParameter(0.75)))); - delete catpb; + ASSERT_DOUBLE_EQ(0.25, catpb.parameterToValue(catpb.midiValueToParameter(catpb.valueToMidiParameter(0.25)))); + ASSERT_DOUBLE_EQ(0.75, catpb.parameterToValue(catpb.midiValueToParameter(catpb.valueToMidiParameter(0.75)))); } { const double minDB = -6; const double maxDB = 0; const double neutralParameter = 1; - ControlAudioTaperPotBehavior* catpb = new ControlAudioTaperPotBehavior(minDB, maxDB, neutralParameter); + ControlAudioTaperPotBehavior catpb(minDB, maxDB, neutralParameter); // Parameter 0 is always 0 (-Infinity) - ASSERT_EQ(0.0, catpb->parameterToValue(0)); + ASSERT_EQ(0.0, catpb.parameterToValue(0)); // Parameter 0 is always 0 (-Infinity) - ASSERT_EQ(1.0, catpb->parameterToValue(neutralParameter)); + ASSERT_EQ(1.0, catpb.parameterToValue(neutralParameter)); // Parameter 1 is always maxDB - ASSERT_EQ(db2ratio(maxDB), catpb->parameterToValue(1)); + ASSERT_EQ(db2ratio(maxDB), catpb.parameterToValue(1)); // value 1 is always on a Integer midi value - double neutralMidi = catpb->valueToMidiParameter(1); + double neutralMidi = catpb.valueToMidiParameter(1); ASSERT_EQ(0.0, fmod(neutralMidi, 1)); // Midi value 64 should result in 0,5 - ASSERT_EQ(neutralParameter, catpb->midiValueToParameter(neutralMidi)); + ASSERT_EQ(neutralParameter, catpb.midiValueToParameter(neutralMidi)); // roundtrip checkx - ASSERT_DOUBLE_EQ(0.25, catpb->parameterToValue(catpb->midiValueToParameter(catpb->valueToMidiParameter(0.25)))); - ASSERT_DOUBLE_EQ(0.75, catpb->parameterToValue(catpb->midiValueToParameter(catpb->valueToMidiParameter(0.75)))); - delete catpb; + ASSERT_DOUBLE_EQ(0.25, catpb.parameterToValue(catpb.midiValueToParameter(catpb.valueToMidiParameter(0.25)))); + ASSERT_DOUBLE_EQ(0.75, catpb.parameterToValue(catpb.midiValueToParameter(catpb.valueToMidiParameter(0.75)))); } } diff --git a/src/test/beatgridtest.cpp b/src/test/beatgridtest.cpp index 86a9104452..9ca5da5b9d 100644 --- a/src/test/beatgridtest.cpp +++ b/src/test/beatgridtest.cpp @@ -2,23 +2,11 @@ #include <QtDebug> #include "track/beatgrid.h" +#include "util/memory.h" namespace { -class BeatGridTest : public testing::Test { - protected: - - BeatGridTest() { - } - - virtual void SetUp() { - } - - virtual void TearDown() { - } -}; - -TEST_F(BeatGridTest, Scale) { +TEST(BeatGridTest, Scale) { TrackPointer pTrack(Track::newTemporary()); int sampleRate = 44100; @@ -26,7 +14,7 @@ TEST_F(BeatGridTest, Scale) { pTrack->setBpm(bpm); pTrack->setSampleRate(sampleRate); - BeatGrid* pGrid = new BeatGrid(*pTrack, 0); + auto pGrid = std::make_unique<BeatGrid>(*pTrack, 0); pGrid->setBpm(bpm); EXPECT_DOUBLE_EQ(bpm, pGrid->getBpm()); @@ -43,7 +31,7 @@ TEST_F(BeatGridTest, Scale) { EXPECT_DOUBLE_EQ(bpm / 2, pGrid->getBpm()); } -TEST_F(BeatGridTest, TestNthBeatWhenOnBeat) { +TEST(BeatGridTest, TestNthBeatWhenOnBeat) { TrackPointer pTrack(Track::newTemporary()); int sampleRate = 44100; @@ -53,7 +41,7 @@ TEST_F(BeatGridTest, TestNthBeatWhenOnBeat) { pTrack->setSampleRate(sampleRate); double beatLength = (60.0 * sampleRate / bpm) * kFrameSize; - BeatGrid* pGrid = new BeatGrid(*pTrack, 0); + auto pGrid = std::make_unique<BeatGrid>(*pTrack, 0); pGrid->setBpm(bpm); // Pretend we're on the 20th beat; double position = beatLength * 20; @@ -79,7 +67,7 @@ TEST_F(BeatGridTest, TestNthBeatWhenOnBeat) { EXPECT_EQ(position, pGrid->findPrevBeat(position)); } -TEST_F(BeatGridTest, TestNthBeatWhenOnBeat_BeforeEpsilon) { +TEST(BeatGridTest, TestNthBeatWhenOnBeat_BeforeEpsilon) { TrackPointer pTrack(Track::newTemporary()); int sampleRate = 44100; @@ -89,7 +77,7 @@ TEST_F(BeatGridTest, TestNthBeatWhenOnBeat_BeforeEpsilon) { pTrack->setSampleRate(sampleRate); double beatLength = (60.0 * sampleRate / bpm) * kFrameSize; - BeatGrid* pGrid = new BeatGrid(*pTrack, 0); + auto pGrid = std::make_unique<BeatGrid>(*pTrack, 0); pGrid->setBpm(bpm); // Pretend we're just before the 20th beat. @@ -117,7 +105,7 @@ TEST_F(BeatGridTest, TestNthBeatWhenOnBeat_BeforeEpsilon) { EXPECT_EQ(kClosestBeat, pGrid->findPrevBeat(position)); } -TEST_F(BeatGridTest, TestNthBeatWhenOnBeat_AfterEpsilon) { +TEST(BeatGridTest, TestNthBeatWhenOnBeat_AfterEpsilon) { TrackPointer pTrack(Track::newTemporary()); int sampleRate = 44100; @@ -127,7 +115,7 @@ TEST_F(BeatGridTest, TestNthBeatWhenOnBeat_AfterEpsilon) { pTrack->setSampleRate(sampleRate); double beatLength = (60.0 * sampleRate / bpm) * kFrameSize; - BeatGrid* pGrid = new BeatGrid(*pTrack, 0); + auto pGrid = std::make_unique<BeatGrid>(*pTrack, 0); pGrid->setBpm(bpm); // Pretend we're just before the 20th beat. @@ -155,7 +143,7 @@ TEST_F(BeatGridTest, TestNthBeatWhenOnBeat_AfterEpsilon) { EXPECT_EQ(kClosestBeat, pGrid->findPrevBeat(position)); } -TEST_F(BeatGridTest, TestNthBeatWhenNotOnBeat) { +TEST(BeatGridTest, TestNthBeatWhenNotOnBeat) { TrackPointer pTrack(Track::newTemporary()); int sampleRate = 44100; double bpm = 60.0; @@ -164,7 +152,7 @@ TEST_F(BeatGridTest, TestNthBeatWhenNotOnBeat) { pTrack->setSampleRate(sampleRate); double beatLength = (60.0 * sampleRate / bpm) * kFrameSize; - BeatGrid* pGrid = new BeatGrid(*pTrack, 0); + auto pGrid = std::make_unique<BeatGrid>(*pTrack, 0); pGrid->setBpm(bpm); // Pretend we're half way between the 20th and 21st beat diff --git a/src/test/beatmaptest.cpp b/src/test/beatmaptest.cpp index 5fecfb0af0..42ff7a0c38 100644 --- a/src/test/beatmaptest.cpp +++ b/src/test/beatmaptest.cpp @@ -2,6 +2,7 @@ #include <QtDebug> #include "track/beatmap.h" +#include "util/memory.h" namespace { @@ -15,12 +16,6 @@ class BeatMapTest : public testing::Test { } - virtual void SetUp() { - } - - virtual void TearDown() { - } - double getBeatLengthFrames(double bpm) { return (60.0 * m_iSampleRate / bpm); } @@ -53,7 +48,7 @@ TEST_F(BeatMapTest, Scale) { const int numBeats = 100; // Note beats must be in frames, not samples. QVector<double> beats = createBeatVector(startOffsetFrames, numBeats, beatLengthFrames); - BeatMap* pMap = new BeatMap(*m_pTrack, 0, beats); + auto pMap = std::make_unique<BeatMap>(*m_pTrack, 0, beats); EXPECT_DOUBLE_EQ(bpm, pMap->getBpm()); pMap->scale(Beats::DOUBLE); @@ -80,7 +75,7 @@ TEST_F(BeatMapTest, TestNthBeat) { const int numBeats = 100; // Note beats must be in frames, not samples. QVector<double> beats = createBeatVector(startOffsetFrames, numBeats, beatLengthFrames); - BeatMap* pMap = new BeatMap(*m_pTrack, 0, beats); + auto pMap = std::make_unique<BeatMap>(*m_pTrack, 0, beats); // Check edge cases double firstBeat = startOffsetSamples + beatLengthSamples * 0; @@ -113,7 +108,7 @@ TEST_F(BeatMapTest, TestNthBeatWhenOnBeat) { const int numBeats = 100; // Note beats must be in frames, not samples. QVector<double> beats = createBeatVector(startOffsetFrames, numBeats, beatLengthFrames); - BeatMap* pMap = new BeatMap(*m_pTrack, 0, beats); + auto pMap = std::make_unique<BeatMap>(*m_pTrack, 0, beats); // Pretend we're on the 20th beat; const int curBeat = 20; @@ -151,7 +146,7 @@ TEST_F(BeatMapTest, TestNthBeatWhenOnBeat_BeforeEpsilon) { const int numBeats = 100; // Note beats must be in frames, not samples. QVector<double> beats = createBeatVector(startOffsetFrames, numBeats, beatLengthFrames); - BeatMap* pMap = new BeatMap(*m_pTrack, 0, beats); + auto pMap = std::make_unique<BeatMap>(*m_pTrack, 0, beats); // Pretend we're just before the 20th beat; const int curBeat = 20; @@ -191,7 +186,7 @@ TEST_F(BeatMapTest, TestNthBeatWhenOnBeat_AfterEpsilon) { const int numBeats = 100; // Note beats must be in frames, not samples. QVector<double> beats = createBeatVector(startOffsetFrames, numBeats, beatLengthFrames); - BeatMap* pMap = new BeatMap(*m_pTrack, 0, beats); + auto pMap = std::make_unique<BeatMap>(*m_pTrack, 0, beats); // Pretend we're just after the 20th beat; const int curBeat = 20; @@ -232,7 +227,7 @@ TEST_F(BeatMapTest, TestNthBeatWhenNotOnBeat) { const int numBeats = 100; // Note beats must be in frames, not samples. QVector<double> beats = createBeatVector(startOffsetFrames, numBeats, beatLengthFrames); - BeatMap* pMap = new BeatMap(*m_pTrack, 0, beats); + auto pMap = std::make_unique<BeatMap>(*m_pTrack, 0, beats); // Pretend we're half way between the 20th and 21st beat double previousBeat = startOffsetSamples + beatLengthSamples * 20.0; @@ -273,7 +268,7 @@ TEST_F(BeatMapTest, TestBpmAround) { beat_pos += beat_length; } - BeatMap* pMap = new BeatMap(*m_pTrack, 0, beats); + auto pMap = std::make_unique<BeatMap>(*m_pTrack, 0, beats); // The average of the first 8 beats should be different than the average // of the last 8 beats. @@ -286,14 +281,11 @@ TEST_F(BeatMapTest, TestBpmAround) { pMap->getBpmAroundPosition(0, 4)); EXPECT_DOUBLE_EQ(118.98016997167139, pMap->getBpmAroundPosition(65 * approx_beat_length, 4)); - delete pMap; // Try a really, really short track beats = createBeatVector(10, 3, getBeatLengthFrames(filebpm)); - pMap = new BeatMap(*m_pTrack, 0, beats); - + pMap = std::make_unique<BeatMap>(*m_pTrack, 0, beats); EXPECT_DOUBLE_EQ(filebpm, pMap->getBpmAroundPosition(1 * approx_beat_length, 4)); - delete pMap; } } // namespace diff --git a/src/test/controller_preset_validation_test.cpp b/src/test/controller_preset_validation_test.cpp index c9f221db3e..d49ee3e50b 100644 --- a/src/test/controller_preset_validation_test.cpp +++ b/src/test/controller_preset_validation_test.cpp @@ -122,7 +122,7 @@ FakeController::~FakeController() { class ControllerPresetValidationTest : public MixxxTest { protected: - virtual void SetUp() { + void SetUp() override { m_presetPaths << QDir::currentPath() + "/res/controllers"; m_pEnumerator.reset(new PresetInfoEnumerator(m_presetPaths)); } diff --git a/src/test/controllerengine_test.cpp b/src/test/controllerengine_test.cpp index a9f080ef35..fb8324410b 100644 --- a/src/test/controllerengine_test.cpp +++ b/src/test/controllerengine_test.cpp @@ -13,7 +13,7 @@ class ControllerEngineTest : public MixxxTest { protected: - virtual void SetUp() { + void SetUp() override { mixxx::Time::setTestMode(true); mixxx::Time::setTestElapsedTime(mixxx::Duration::fromMillis(10)); QThread::currentThread()->setObjectName("Main"); @@ -22,7 +22,7 @@ class ControllerEngineTest : public MixxxTest { cEngine->setPopups(false); } - virtual void TearDown() { + void TearDown() override { cEngine->gracefulShutdown(); delete cEngine; mixxx::Time::setTestMode(false); diff --git a/src/test/controlobjecttest.cpp b/src/test/controlobjecttest.cpp index dfd6a02807..5201aad37a 100644 --- a/src/test/controlobjecttest.cpp +++ b/src/test/controlobjecttest.cpp @@ -2,41 +2,22 @@ #include <QtDebug> #include "control/controlobject.h" +#include "util/memory.h" namespace { class ControlObjectTest : public testing::Test { protected: - - ControlObjectTest() { - qDebug() << "ControlObjectTest()"; - } - - virtual void SetUp() { - qDebug() << "SetUp"; + void SetUp() override { ck1 = ConfigKey("[Channel1]", "co1"); ck2 = ConfigKey("[Channel1]", "co2"); - co1 = new ControlObject(ck1); - co2 = new ControlObject(ck2); - } - - virtual void TearDown() { - qDebug() << "TearDown"; - if(co1) { - qDebug() << "Deleting " << co1; - delete co1; - co1 = NULL; - } - if(co2) { - qDebug() << "Deleting " << co2; - delete co2; - co2 = NULL; - } + co1 = std::make_unique<ControlObject>(ck1); + co2 = std::make_unique<ControlObject>(ck2); } ConfigKey ck1, ck2; - ControlObject *co1, *co2; - + std::unique_ptr<ControlObject> co1; + std::unique_ptr<ControlObject> co2; }; TEST_F(ControlObjectTest, setGet) { @@ -47,11 +28,10 @@ TEST_F(ControlObjectTest, setGet) { } TEST_F(ControlObjectTest, getControl) { - EXPECT_EQ(ControlObject::getControl(ck1), co1); - EXPECT_EQ(ControlObject::getControl(ck2), co2); - delete co2; - co2 = NULL; - EXPECT_EQ(ControlObject::getControl(ck2), (ControlObject*)NULL); + EXPECT_EQ(ControlObject::getControl(ck1), co1.get()); + EXPECT_EQ(ControlObject::getControl(ck2), co2.get()); + co2.reset(); + EXPECT_EQ(ControlObject::getControl(ck2), (ControlObject*)nullptr); } TEST_F(ControlObjectTest, aliasRetrieval) { @@ -59,13 +39,13 @@ TEST_F(ControlObjectTest, aliasRetrieval) { ConfigKey ckAlias("[Microphone]", "volume"); // Create the Control Object - ControlObject* co = new ControlObject(ck); + auto co = std::make_unique<ControlObject>(ck); // Insert the alias before it is going to be used ControlDoublePrivate::insertAlias(ckAlias, ck); // Check if getControl on alias returns us the original ControlObject - EXPECT_EQ(ControlObject::getControl(ckAlias), co); + EXPECT_EQ(ControlObject::getControl(ckAlias), co.get()); } } diff --git a/src/test/coverartcache_test.cpp b/src/test/coverartcache_test.cpp index f9692e9758..9974dc56e7 100644 --- a/src/test/coverartcache_test.cpp +++ b/src/test/coverartcache_test.cpp @@ -12,12 +12,6 @@ // construct the default QPixmap in CoverArtCache class CoverArtCacheTest : public MixxxTest, public CoverArtCache { protected: - virtual void SetUp() { - } - - virtual void TearDown() { - } - void loadCoverFromMetadata(QString trackLocation) { CoverInfo info; info.type = CoverInfo::METADATA; diff --git a/src/test/coverartutils_test.cpp b/src/test/coverartutils_test.cpp index 15295a8c26..aa347548f5 100644 --- a/src/test/coverartutils_test.cpp +++ b/src/test/coverartutils_test.cpp @@ -34,11 +34,11 @@ void extractEmbeddedCover( // construct the default QPixmap in CoverArtCache class CoverArtUtilTest : public MixxxTest, public CoverArtCache { protected: - virtual void SetUp() { + void SetUp() override { m_pTrackCollection = new TrackCollection(config()); } - virtual void TearDown() { + void TearDown() override { // make sure we clean up the db QSqlQuery query(m_pTrackCollection->getDatabase()); query.prepare("DELETE FROM " % DIRECTORYDAO_TABLE); diff --git a/src/test/dbidtest.cpp b/src/test/dbidtest.cpp index 3cab1ed7b8..b0f5715c0b 100644 --- a/src/test/dbidtest.cpp +++ b/src/test/dbidtest.cpp @@ -8,16 +8,6 @@ namespace { class DbIdTest : public testing::Test { protected: - - DbIdTest() { - } - - virtual void SetUp() { - } - - virtual void TearDown() { - } - static DbId fromValidVariant(const QVariant& variant) { DbId actual(variant); EXPECT_TRUE(actual.isValid()); diff --git a/src/test/directorydoatest.cpp b/src/test/directorydoatest.cpp index 355cf7c707..b9b0c1609b 100644 --- a/src/test/directorydoatest.cpp +++ b/src/test/directorydoatest.cpp @@ -22,12 +22,12 @@ namespace { class DirectoryDAOTest : public MixxxTest { protected: - virtual void SetUp() { + void SetUp() override { m_pTrackCollection = new TrackCollection(config()); m_supportedFileExt = "." % SoundSourceProxy::getSupportedFileExtensions().first(); } - virtual void TearDown() { + void TearDown() override { // make sure we clean up the db QSqlQuery query(m_pTrackCollection->getDatabase()); query.prepare("DELETE FROM " % DIRECTORYDAO_TABLE); diff --git a/src/test/durationutiltest.cpp b/src/test/durationutiltest.cpp index 03310aec51..7fec8b61f1 100644 --- a/src/test/durationutiltest.cpp +++ b/src/test/durationutiltest.cpp @@ -8,16 +8,6 @@ namespace { class DurationUtilTest : public testing::Test { protected: - - DurationUtilTest() { - } - - virtual void SetUp() { - } - - virtual void TearDown() { - } - static QString adjustPrecision( QString withMilliseconds, mixxx::Duration::Precision precision) { @@ -34,7 +24,7 @@ class DurationUtilTest : public testing::Test { return withMilliseconds; } } - + void formatSeconds(QString expectedMilliseconds, double dSeconds) { ASSERT_LE(4, expectedMilliseconds.length()); // 3 digits + 1 decimal point const QString actualSeconds = diff --git a/src/test/effectsmanagertest.cpp b/src/test/effectsmanagertest.cpp index a554297e73..d18744056d 100644 --- a/src/test/effectsmanagertest.cpp +++ b/src/test/effectsmanagertest.cpp @@ -17,7 +17,7 @@ using ::testing::_; class EffectsManagerTest : public BaseEffectTest { protected: - virtual void SetUp() { + void SetUp() override { registerTestBackend(); } }; diff --git a/src/test/enginebufferscalelineartest.cpp b/src/test/enginebufferscalelineartest.cpp index 49b80c4ba0..224c45d3e8 100644 --- a/src/test/enginebufferscalelineartest.cpp +++ b/src/test/enginebufferscalelineartest.cpp @@ -61,12 +61,12 @@ class ReadAheadManagerMock : public ReadAheadManager { class EngineBufferScaleLinearTest : public MixxxTest { protected: - virtual void SetUp() { + void SetUp() override { m_pReadAheadMock = new StrictMock<ReadAheadManagerMock>(); m_pScaler = new EngineBufferScaleLinear(m_pReadAheadMock); } - virtual void TearDown() { + void TearDown() override { delete m_pScaler; delete m_pReadAheadMock; } diff --git a/src/test/enginemastertest.cpp b/src/test/enginemastertest.cpp index b7b44d7e33..1bd44473fe 100644 --- a/src/test/enginemastertest.cpp +++ b/src/test/enginemastertest.cpp @@ -39,13 +39,13 @@ class EngineChannelMock : public EngineChannel { class EngineMasterTest : public MixxxTest { protected: - virtual void SetUp() { + void SetUp() override { m_pMaster = new EngineMaster(config(), "[Master]", NULL, false, false); m_pMasterEnabled = new ControlProxy(ConfigKey("[Master]", "enabled")); m_pMasterEnabled->set(1); } - virtual void TearDown() { + void TearDown() override { delete m_pMaster; delete m_pMasterEnabled; } diff --git a/src/test/enginemicrophonetest.cpp b/src/test/enginemicrophonetest.cpp index b94d880327..a5fd0642c2 100644 --- a/src/test/enginemicrophonetest.cpp +++ b/src/test/enginemicrophonetest.cpp @@ -14,7 +14,7 @@ namespace { class EngineMicrophoneTest : public testing::Test { protected: - virtual void SetUp() { + void SetUp() override { inputLength = MAX_BUFFER_LEN; outputLength = MAX_BUFFER_LEN; input = SampleUtil::alloc(inputLength); @@ -27,7 +27,7 @@ class EngineMicrophoneTest : public testing::Test { m_pTalkover = ControlObject::getControl(ConfigKey("[Microphone]", "talkover")); } - virtual void TearDown() { + void TearDown() override { SampleUtil::free(input); SampleUtil::free(output); SampleUtil::free(test); diff --git a/src/test/lcstest.cpp b/src/test/lcstest.cpp index 7bd268cfa0..f0af01249b 100644 --- a/src/test/lcstest.cpp +++ b/src/test/lcstest.cpp @@ -3,16 +3,7 @@ #include "util/lcs.h" -class LCSTest : public testing::Test { - protected: - virtual void SetUp() { - } - - virtual void TearDown() { - } -}; - -TEST_F(LCSTest, BasicLCS) { +TEST(LCS, BasicLCS) { ASSERT_STREQ(qPrintable(QString("FOO")), qPrintable(LCS("FOO", "FOO"))); diff --git a/src/test/learningutilstest.cpp b/src/test/learningutilstest.cpp index 9302bf6721..664c88a827 100644 --- a/src/test/learningutilstest.cpp +++ b/src/test/learningutilstest.cpp @@ -2,6 +2,7 @@ #include "test/mixxxtest.h" #include "controllers/learningutils.h" +#include "util/memory.h" std::ostream& operator<<(std::ostream& stream, const MidiInputMapping& mapping) { |