Small updates on the unit tests

pull/495/head
abscisys 2 years ago
parent d9500d6c32
commit 8aa37f20ef
  1. 2
      src/fx_engine.hpp
  2. 3
      src/fx_unit.hpp
  3. 3
      src/fx_unit2.hpp
  4. 26
      src/mixing_console_constants.h
  5. 2
      src/test/test_fx_rack.cpp
  6. 98
      src/test/test_mixing_console.cpp

@ -199,7 +199,7 @@ public:
buffer_(nullptr),
write_ptr_(0)
{
memset(this->lfo_value_, 0, LFOIndex::kLFOCount * sizeof(T));
memset(this->lfo_value_, 0, LFOIndex::kLFOCount * sizeof(float32_t));
}
~Context()

@ -20,9 +20,6 @@
#include "fx_components.h"
#include <iostream>
using namespace std;
class FXUnitModule
{
DISALLOW_COPY_AND_ASSIGN(FXUnitModule);

@ -20,9 +20,6 @@
#include "fx_components.h"
#include <iostream>
using namespace std;
class FXUnitModule2
{
DISALLOW_COPY_AND_ASSIGN(FXUnitModule2);

@ -38,26 +38,28 @@ inline std::string toString(MixerOutput enum_val)
"Orbitone",
"Phaser",
"Delay",
"Plate Reverb",
"Shimmer Reverb",
"Main Output"
"PlateReverb",
"ShimmerReverb",
"MainOutput"
};
static_assert(names.size() == MixerOutput::kFXCount, "Enum MixerOutput and string array size mismatch");
return std::string(names[static_cast<size_t>(enum_val)]);
}
#define TO_INDEX_CHECK(str, fx) if(std::strcmp(str, toString(fx).c_str()) == 0) return fx;
inline MixerOutput toIndex(const char* str)
{
if(strcmp(str, "Tube") == 0) return MixerOutput::FX_Tube;
if(strcmp(str, "Chorus") == 0) return MixerOutput::FX_Chorus;
if(strcmp(str, "Flanger") == 0) return MixerOutput::FX_Flanger;
if(strcmp(str, "Orbitone") == 0) return MixerOutput::FX_Orbitone;
if(strcmp(str, "Phaser") == 0) return MixerOutput::FX_Phaser;
if(strcmp(str, "Delay") == 0) return MixerOutput::FX_Delay;
if(strcmp(str, "PlateReverb") == 0) return MixerOutput::FX_PlateReverb;
if(strcmp(str, "ShimmerReverb") == 0) return MixerOutput::FX_ShimmerReverb;
if(strcmp(str, "MainOutput") == 0) return MixerOutput::MainOutput;
TO_INDEX_CHECK(str, MixerOutput::FX_Tube);
TO_INDEX_CHECK(str, MixerOutput::FX_Chorus);
TO_INDEX_CHECK(str, MixerOutput::FX_Flanger);
TO_INDEX_CHECK(str, MixerOutput::FX_Orbitone);
TO_INDEX_CHECK(str, MixerOutput::FX_Phaser);
TO_INDEX_CHECK(str, MixerOutput::FX_Delay);
TO_INDEX_CHECK(str, MixerOutput::FX_PlateReverb);
TO_INDEX_CHECK(str, MixerOutput::FX_ShimmerReverb);
TO_INDEX_CHECK(str, MixerOutput::MainOutput);
throw std::invalid_argument("Invalid MixerOutput string");
}

@ -92,7 +92,7 @@ TEST_P(FXScenarioTest, ScenarioProcessing)
setupRack(rack);
rack->reset();
int fxSwitch = GetParam();
int fxSwitch = this->GetParam();
activateRackFXUnitScenario(rack, fxSwitch);

@ -18,101 +18,17 @@ void normalizedValueInspector(const std::string& el, size_t idx, const float32_t
}
}
TEST(MixerOutputTest, toStringForTube)
{
auto v = toString(MixerOutput::FX_Tube);
EXPECT_EQ(v, "Tube");
}
TEST(MixerOutputTest, toStringForChorus)
{
auto v = toString(MixerOutput::FX_Chorus);
EXPECT_EQ(v, "Chorus");
}
TEST(MixerOutputTest, toStringForFlanger)
{
auto v = toString(MixerOutput::FX_Flanger);
EXPECT_EQ(v, "Flanger");
}
TEST(MixerOutputTest, toStringForOrbitone)
{
auto v = toString(MixerOutput::FX_Orbitone);
EXPECT_EQ(v, "Orbitone");
}
class MixingConsoleScenarioTest : public testing::TestWithParam<MixerOutput> {};
TEST(MixerOutputTest, toStringForPhaser)
TEST_P(MixingConsoleScenarioTest, MixerOutputTest)
{
auto v = toString(MixerOutput::FX_Phaser);
EXPECT_EQ(v, "Phaser");
MixerOutput v = this->GetParam();
std::string str = toString(v);
MixerOutput mo = toIndex(str.c_str());
EXPECT_EQ(v, mo);
}
TEST(MixerOutputTest, toStringForDelay)
{
auto v = toString(MixerOutput::FX_Delay);
EXPECT_EQ(v, "Delay");
}
TEST(MixerOutputTest, toStringForPlateReverb)
{
auto v = toString(MixerOutput::FX_PlateReverb);
EXPECT_EQ(v, "Plate Reverb");
}
TEST(MixerOutputTest, toStringForShimmerReverb)
{
auto v = toString(MixerOutput::FX_ShimmerReverb);
EXPECT_EQ(v, "Shimmer Reverb");
}
TEST(MixerOutputTest, toIndexTube)
{
MixerOutput v = toIndex("Tube");
EXPECT_EQ(v, MixerOutput::FX_Tube);
}
TEST(MixerOutputTest, toIndexChorus)
{
MixerOutput v = toIndex("Chorus");
EXPECT_EQ(v, MixerOutput::FX_Chorus);
}
TEST(MixerOutputTest, toIndexFlanger)
{
MixerOutput v = toIndex("Flanger");
EXPECT_EQ(v, MixerOutput::FX_Flanger);
}
TEST(MixerOutputTest, toIndexOrbitone)
{
MixerOutput v = toIndex("Orbitone");
EXPECT_EQ(v, MixerOutput::FX_Orbitone);
}
TEST(MixerOutputTest, toIndexPhaser)
{
MixerOutput v = toIndex("Phaser");
EXPECT_EQ(v, MixerOutput::FX_Phaser);
}
TEST(MixerOutputTest, toIndexDelay)
{
MixerOutput v = toIndex("Delay");
EXPECT_EQ(v, MixerOutput::FX_Delay);
}
TEST(MixerOutputTest, toIndexPlateReverb)
{
MixerOutput v = toIndex("PlateReverb");
EXPECT_EQ(v, MixerOutput::FX_PlateReverb);
}
TEST(MixerOutputTest, toIndexShimmerReverb)
{
MixerOutput v = toIndex("ShimmerReverb");
EXPECT_EQ(v, MixerOutput::FX_ShimmerReverb);
}
INSTANTIATE_TEST_SUITE_P(MixerOutputTest, MixingConsoleScenarioTest, testing::Range(MixerOutput::OutputStart, MixerOutput::kFXCount));
typedef MixingConsole<8> Mixer;

Loading…
Cancel
Save