Skip to content

Commit

Permalink
Bring YM2612 helper method in line with others
Browse files Browse the repository at this point in the history
  • Loading branch information
rhargreaves committed Feb 19, 2025
1 parent e61c582 commit b19a8d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
18 changes: 10 additions & 8 deletions tests/mocks/mock_ym2612.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,19 @@ void _expect_ym2612_write_reg_any_data(u8 part, u8 reg, const char* const file,
expect_function_call(__wrap_Z80_releaseBus);
}

void expect_ym2612_write_operator_any_data(u8 chan, u8 op, u8 baseReg)
void _expect_ym2612_write_operator_any_data(
u8 chan, u8 op, u8 baseReg, const char* const file, const int line)
{
expect_value(__wrap_Z80_getAndRequestBus, wait, TRUE);
will_return(__wrap_Z80_getAndRequestBus, false);
expect_value_with_pos(__wrap_Z80_getAndRequestBus, wait, TRUE, file, line);
will_return_with_pos(__wrap_Z80_getAndRequestBus, false, file, line);

expect_value(__wrap_YM2612_writeReg, part, REG_PART(chan));
expect_value(__wrap_YM2612_writeReg, reg, baseReg + REG_OFFSET(chan) + (regOpIndex(op) * 4));
expect_any(__wrap_YM2612_writeReg, data);
expect_value_with_pos(__wrap_YM2612_writeReg, part, REG_PART(chan), file, line);
expect_value_with_pos(
__wrap_YM2612_writeReg, reg, baseReg + REG_OFFSET(chan) + (regOpIndex(op) * 4), file, line);
expect_any_with_pos(__wrap_YM2612_writeReg, data, file, line);

expect_value(__wrap_YM2612_write, port, 0);
expect_value(__wrap_YM2612_write, data, 0x2A);
expect_value_with_pos(__wrap_YM2612_write, port, 0, file, line);
expect_value_with_pos(__wrap_YM2612_write, data, 0x2A, file, line);

expect_function_call(__wrap_Z80_releaseBus);
}
Expand Down
5 changes: 4 additions & 1 deletion tests/mocks/mock_ym2612.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ void _expect_ym2612_write_channel_any_data(
u8 chan, u8 baseReg, const char* const file, const int line);
void _expect_ym2612_write_operator(
u8 chan, u8 op, u8 baseReg, u8 data, const char* const file, const int line);
void expect_ym2612_write_operator_any_data(u8 chan, u8 op, u8 baseReg);
void _expect_ym2612_write_operator_any_data(
u8 chan, u8 op, u8 baseReg, const char* const file, const int line);
void _expect_ym2612_write_all_operators(
u8 chan, u8 baseReg, u8 data, const char* const file, const int line);
void _expect_ym2612_write_all_operators_any_data(
Expand All @@ -35,6 +36,8 @@ void _expect_ym2612_note_off(u8 chan, const char* const file, const int line);
_expect_ym2612_write_channel_any_data(chan, baseReg, __FILE__, __LINE__)
#define expect_ym2612_write_operator(chan, op, baseReg, data) \
_expect_ym2612_write_operator(chan, op, baseReg, data, __FILE__, __LINE__)
#define expect_ym2612_write_operator_any_data(chan, op, baseReg) \
_expect_ym2612_write_operator_any_data(chan, op, baseReg, __FILE__, __LINE__)
#define expect_ym2612_write_all_operators(chan, baseReg, data) \
_expect_ym2612_write_all_operators(chan, baseReg, data, __FILE__, __LINE__)
#define expect_ym2612_write_all_operators_any_data(chan, baseReg) \
Expand Down

0 comments on commit b19a8d1

Please sign in to comment.