Testing the interface
We have a few things to test in this DSL:
- Integration: Testing whether the DSL plays well with the
NotePlayer
module to ensure the whole project is functional - Sequences: Testing whether sequences are defined in the correct order and the defaults for
note
are working - Restrictions: Testing whether the DSL works as expected and
note
andembed_notes
can only be called insidesequence
Writing integration tests
Let’s start by adding the integration test:
test/mix_music/integration_test.exs
defmodule MixMusic.DoReMi do use MixMusic.DSL sequence :do_re_mi do note(:c, octet: 4, volume: 50, duration: 0.25) note(:d, modifier: :base, duration: 0.25) note(:e, modifier: :base, duration: 0.25) end sequence :fa_so_la_ti_do do note(:f, octet: 4, volume: 50, duration: 0.25) ...