Skip to content

Commit

Permalink
Use -O0 for coverage info
Browse files Browse the repository at this point in the history
  • Loading branch information
tttapa committed Oct 12, 2019
1 parent b0b0f4d commit 4549007
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} \
-Wmissing-include-dirs")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-g3 -ggdb -Og -Wall -Wextra -Werror \
-g3 -ggdb -O0 -Wall -Wextra -Werror \
-fdiagnostics-show-option -Wsuggest-override \
-Wdouble-promotion \
-Wswitch-default -Wswitch-enum -Wimplicit-fallthrough=3 \
-Wstrict-overflow=5 \
-Wuninitialized \
-pedantic -pedantic-errors")

Expand Down
2 changes: 1 addition & 1 deletion src/MIDI_Inputs/MIDIInputElement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MIDIInputElement {
virtual void begin() {}

/// Reset the input element to its initial state.
virtual void reset() = 0;
virtual void reset() {}

/// Update the value of the input element. Used for decaying VU meters etc.
virtual void update() {}
Expand Down
30 changes: 30 additions & 0 deletions test/MIDI_Inputs/tests-MCU_VU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,36 @@ TEST(MCUVU, decay) {
Mock::VerifyAndClear(&ArduinoMock::getInstance());
}

TEST(MCUVU, getFloatValue) {
constexpr Channel channel = CHANNEL_3;
constexpr uint8_t track = 5;
constexpr unsigned int decayTime = 300;
MCU::VU vu = {track, channel, decayTime};
ChannelMessageMatcher midimsg = {CHANNEL_PRESSURE, channel,
(track - 1) << 4 | 0xA, 0};
EXPECT_CALL(ArduinoMock::getInstance(), millis()).WillOnce(Return(0));
MIDIInputElementChannelPressure::updateAllWith(midimsg);
EXPECT_FLOAT_EQ(vu.getFloatValue(), 10.0f / 12);

Mock::VerifyAndClear(&ArduinoMock::getInstance());
}

TEST(MCUVU, reset) {
constexpr Channel channel = CHANNEL_3;
constexpr uint8_t track = 5;
constexpr unsigned int decayTime = 300;
MCU::VU vu = {track, channel, decayTime};
ChannelMessageMatcher midimsg = {CHANNEL_PRESSURE, channel,
(track - 1) << 4 | 0xA, 0};
EXPECT_CALL(ArduinoMock::getInstance(), millis()).WillOnce(Return(0));
MIDIInputElementChannelPressure::updateAllWith(midimsg);
EXPECT_EQ(vu.getValue(), 0xA);
vu.reset();
EXPECT_EQ(vu.getValue(), 0x0);

Mock::VerifyAndClear(&ArduinoMock::getInstance());
}

// -------------------------------------------------------------------------- //

TEST(MCUVUBankable, setValueBankChangeAddress) {
Expand Down

0 comments on commit 4549007

Please sign in to comment.