Skip to content

Commit

Permalink
Add extreme test for pitch shifting
Browse files Browse the repository at this point in the history
  • Loading branch information
rhargreaves committed Jul 26, 2024
1 parent fe94a33 commit 939d420
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/unit/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ int main(void)
midi_test(test_midi_hides_fm_parameter_ui),
midi_test(test_midi_resets_fm_values_to_defaults),
midi_test(test_midi_resets_psg_values_to_defaults),

pitchcents_test(test_pitchcents_shift_extreme_up),
pitchcents_test(test_pitchcents_bend_nil),
pitchcents_test(test_pitchcents_bend_down_fully),
pitchcents_test(test_pitchcents_bend_up_fully),
Expand Down Expand Up @@ -396,7 +398,6 @@ int main(void)
midi_portamento_test(test_midi_portamento_glides_note_up_with_pitch_bend),
midi_portamento_test(test_midi_portamento_glides_note_down_with_pitch_bend)
// TODO: test for special mode glide
// TODO: pitch bend conflicts
// clang-format on
};

Expand Down
9 changes: 9 additions & 0 deletions tests/unit/test_pitchcents.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#include "test_midi.h"

static void test_pitchcents_shift_extreme_up(UNUSED void** state)
{
PitchCents pc = { .pitch = 50, .cents = 99 };
pc = pitchcents_shift(pc, 255);

assert_int_equal(pc.pitch, 53);
assert_int_equal(pc.cents, 54);
}

static void test_pitchcents_bend_nil(UNUSED void** state)
{
PitchCents pc = pitchcents_bend(50, 0, 0x2000);
Expand Down

0 comments on commit 939d420

Please sign in to comment.