Skip to content

Commit 23b01b9

Browse files
fix: Add basics tests
1 parent 6851c6a commit 23b01b9

File tree

2 files changed

+42
-7
lines changed

2 files changed

+42
-7
lines changed

source/PluginProcessor.h

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ class PluginProcessor : public juce::AudioProcessor, public juce::AudioProcessor
3232

3333
const juce::String getName() const override;
3434

35+
auto numOSCChannels() const { return mOscBridgeChannels.size(); }
36+
3537
// MIDI
3638
bool acceptsMidi() const override;
3739
bool producesMidi() const override;

tests/PluginBasics.cpp

+40-7
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
#include <catch2/catch_test_macros.hpp>
44
#include <catch2/matchers/catch_matchers_string.hpp>
55

6-
TEST_CASE ("one is equal to one", "[dummy]")
7-
{
8-
REQUIRE (1 == 1);
9-
}
10-
116
TEST_CASE ("Plugin instance", "[instance]")
127
{
138
PluginProcessor testPlugin;
@@ -20,10 +15,48 @@ TEST_CASE ("Plugin instance", "[instance]")
2015
SECTION ("name")
2116
{
2217
CHECK_THAT (testPlugin.getName().toStdString(),
23-
Catch::Matchers::Equals ("Pamplejuce Demo"));
18+
Catch::Matchers::Equals ("BirdHouse"));
2419
}
25-
}
2620

21+
auto numOSCChannels = testPlugin.numOSCChannels();
22+
SECTION ("number of OSC channels")
23+
{
24+
CHECK (numOSCChannels == 8);
25+
}
26+
27+
SECTION ("OSC channel")
28+
{
29+
auto& channel = testPlugin.getChannel (0);
30+
31+
// Set path
32+
channel.get()->state().setPath ("/1/value");
33+
CHECK (channel.get()->state().path() == "/1/value");
34+
35+
// Set inMin
36+
channel.get()->state().setInputMin (0.0f);
37+
CHECK (channel.get()->state().inMin() == 0.0f);
38+
39+
// Set inMax
40+
channel.get()->state().setInputMax (1.0f);
41+
CHECK (channel.get()->state().inMax() == 1.0f);
42+
43+
// Set midiChan
44+
channel.get()->state().setOutputMidiChannel (1);
45+
CHECK (channel.get()->state().outChan() == 1);
46+
47+
// Set midiNum
48+
channel.get()->state().setOutputMidiNum (1);
49+
CHECK (channel.get()->state().outNum() == 1);
50+
51+
// Set msgType
52+
channel.get()->state().setOutputType (static_cast<birdhouse::MsgType> (1));
53+
CHECK (channel.get()->state().outType() == 1);
54+
55+
// Set muted
56+
channel.get()->state().setMuted (false);
57+
CHECK_FALSE (channel.get()->state().muted());
58+
}
59+
}
2760

2861
#ifdef PAMPLEJUCE_IPP
2962
#include <ipp.h>

0 commit comments

Comments
 (0)