Skip to content

Commit

Permalink
Adding chord tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Hillel authored and Andrew Hillel committed Mar 13, 2024
1 parent 2b1f528 commit 2e24823
Show file tree
Hide file tree
Showing 8 changed files with 796 additions and 552 deletions.
2 changes: 1 addition & 1 deletion mosaic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function redraw()
end

function init()
-- math.randomseed(os.time())
math.randomseed(os.time())
program.init()
midi_controller.init()

Expand Down
12 changes: 4 additions & 8 deletions tests/lib/clock_controller_tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function test_clock_divisions_slow_down_the_clock_div_2()

progress_clock_by_beats(1)

local note_on_event = table.remove(midi_note_on_events)
local note_on_event = table.remove(midi_note_on_events, 1)

luaunit.assert_equals(note_on_event[1], 60)
luaunit.assert_equals(note_on_event[2], 100)
Expand Down Expand Up @@ -124,7 +124,7 @@ function test_clock_divisions_slow_down_the_clock_div_3()

progress_clock_by_beats(1)

local note_on_event = table.remove(midi_note_on_events)
local note_on_event = table.remove(midi_note_on_events, 1)

luaunit.assert_equals(note_on_event[1], 60)
luaunit.assert_equals(note_on_event[2], 100)
Expand Down Expand Up @@ -178,7 +178,7 @@ function test_clock_multiplications_speed_up_the_clock_mul_2()

progress_clock_by_beats(1)

local note_on_event = table.remove(midi_note_on_events)
local note_on_event = table.remove(midi_note_on_events, 1)

luaunit.assert_equals(note_on_event[1], 60)
luaunit.assert_equals(note_on_event[2], 100)
Expand Down Expand Up @@ -223,7 +223,7 @@ function test_clock_multiplications_speed_up_the_clock_mul_16()

progress_clock_by_beats(1)

local note_on_event = table.remove(midi_note_on_events)
local note_on_event = table.remove(midi_note_on_events, 1)

luaunit.assert_equals(note_on_event[1], 60)
luaunit.assert_equals(note_on_event[2], 100)
Expand Down Expand Up @@ -354,7 +354,3 @@ function test_clock_can_delay_action_with_channel_clock_division_set()
luaunit.assert_true(has_fired)

end



-- Song mode clock tests
2 changes: 1 addition & 1 deletion tests/lib/integration_tests/channel_tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function test_channel_17_doesnt_fire_notes()
-- Progress the clock according to the current steps being tested
progress_clock_by_beats(steps)

local note_on_event = table.remove(midi_note_on_events)
local note_on_event = table.remove(midi_note_on_events, 1)

-- Check there are no note on events
luaunit.assertNil(note_on_event)
Expand Down
18 changes: 9 additions & 9 deletions tests/lib/integration_tests/note_event_tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function test_pattern_doesnt_fire_when_sequencer_pattern_is_not_selected()
progress_clock_by_beats(steps)


local note_on_event = table.remove(midi_note_on_events)
local note_on_event = table.remove(midi_note_on_events, 1)

-- Check there are no note on events
luaunit.assertNil(note_on_event)
Expand Down Expand Up @@ -113,7 +113,7 @@ function test_pattern_doesnt_fire_when_sequencer_pattern_is_not_selected()
-- Progress the clock according to the current steps being tested
progress_clock_by_beats(steps)

local note_on_event = table.remove(midi_note_on_events)
local note_on_event = table.remove(midi_note_on_events, 1)

luaunit.assert_equals(note_on_event[1], 60)
luaunit.assert_equals(note_on_event[2], 20)
Expand Down Expand Up @@ -167,7 +167,7 @@ function test_pattern_doesnt_fire_when_sequencer_pattern_is_not_selected()
-- Progress the clock according to the current steps being tested
progress_clock_by_beats(steps)

local note_on_event = table.remove(midi_note_on_events)
local note_on_event = table.remove(midi_note_on_events, 1)

luaunit.assert_equals(note_on_event[1], 60)
luaunit.assert_equals(note_on_event[2], 20)
Expand Down Expand Up @@ -218,7 +218,7 @@ function test_clock_processes_notes_at_various_steps()
-- Progress the clock according to the current steps being tested
progress_clock_by_beats(steps)

local note_on_event = table.remove(midi_note_on_events)
local note_on_event = table.remove(midi_note_on_events, 1)

-- Check the note on event
luaunit.assert_equals(note_on_event[1], 60)
Expand Down Expand Up @@ -248,7 +248,7 @@ function test_clock_processes_note_events()

clock_setup()

local note_on_event = table.remove(midi_note_on_events)
local note_on_event = table.remove(midi_note_on_events, 1)

luaunit.assert_equals(note_on_event[1], 60)
luaunit.assert_equals(note_on_event[2], 100)
Expand Down Expand Up @@ -290,7 +290,7 @@ function test_clock_processes_note_events()
-- Reset and set up the clock and MIDI event tracking
clock_setup()

local note_on_event = table.remove(midi_note_on_events)
local note_on_event = table.remove(midi_note_on_events, 1)

-- Check the note on event
luaunit.assert_equals(note_on_event[1], 60)
Expand Down Expand Up @@ -335,23 +335,23 @@ function test_end_trig_functions_as_expected()

clock_setup()

local note_on_event = table.remove(midi_note_on_events)
local note_on_event = table.remove(midi_note_on_events, 1)

luaunit.assert_equals(note_on_event[1], 60)
luaunit.assert_equals(note_on_event[2], 100)
luaunit.assert_equals(note_on_event[3], 1)

progress_clock_by_beats(4)

local note_on_event = table.remove(midi_note_on_events)
local note_on_event = table.remove(midi_note_on_events, 1)

luaunit.assert_equals(note_on_event[1], 60)
luaunit.assert_equals(note_on_event[2], 100)
luaunit.assert_equals(note_on_event[3], 1)

progress_clock_by_beats(4)

local note_on_event = table.remove(midi_note_on_events)
local note_on_event = table.remove(midi_note_on_events, 1)

luaunit.assert_equals(note_on_event[1], 60)
luaunit.assert_equals(note_on_event[2], 100)
Expand Down
Loading

0 comments on commit 2e24823

Please sign in to comment.