Skip to content

Commit

Permalink
Upgrade expect_synth_pitch() to report file/line properly
Browse files Browse the repository at this point in the history
  • Loading branch information
rhargreaves committed Jun 27, 2024
1 parent 11c05ea commit 9380739
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/asserts.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@ void expect_synth_pitch_any(void)
expect_any(__wrap_synth_pitch, freqNumber);
}

void expect_synth_pitch(u8 channel, u8 octave, u16 freqNumber)
void _expect_synth_pitch(u8 channel, u8 octave, u16 freqNumber,
const char* const file, const int line)
{
expect_value(__wrap_synth_pitch, channel, channel);
expect_value(__wrap_synth_pitch, octave, octave);
expect_value(__wrap_synth_pitch, freqNumber, freqNumber);
expect_value_with_pos(__wrap_synth_pitch, channel, channel, file, line);
expect_value_with_pos(__wrap_synth_pitch, octave, octave, file, line);
expect_value_with_pos(
__wrap_synth_pitch, freqNumber, freqNumber, file, line);
}

void expect_synth_volume(u8 channel, u8 volume)
Expand Down
5 changes: 5 additions & 0 deletions tests/asserts.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ void expect_synth_volume_any(void);
void expect_synth_volume(u8 channel, u8 volume);
u8 regOpIndex(u8 op);

void _expect_synth_pitch(u8 channel, u8 octave, u16 freqNumber,
const char* const file, const int line);
void _expect_ym2612_write_reg(
u8 part, u8 reg, u8 data, const char* const file, const int line);
void _expect_ym2612_write_channel(
Expand Down Expand Up @@ -87,6 +89,9 @@ void _expect_ym2612_write_operator(u8 chan, u8 op, u8 baseReg, u8 data,
expect_value(__wrap_comm_megawifi_midiEmitCallback, midiByte, mb2); \
}

#define expect_synth_pitch(channel, octave, freqNumber) \
_expect_synth_pitch(channel, octave, freqNumber, __FILE__, __LINE__)

#define expect_ym2612_write_operator(chan, op, baseReg, data) \
_expect_ym2612_write_operator(chan, op, baseReg, data, __FILE__, __LINE__)

Expand Down

0 comments on commit 9380739

Please sign in to comment.