Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NeroBlackstone committed Jun 1, 2023
1 parent 18cc1d2 commit c10f3a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/namednote.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ NamedNote(n::Note; pitch_name::String = "") =

NamedNotes(notes_string::String; tpq::Int = 960) = Notes([NamedNote(String(s)) for s in split(notes_string," ")], tpq)

Note(n::NamedNote) = Note(name_to_pitch(n.pitch), n.position, n.velocity, n.duration, n.channel)
Note(n::NamedNote) = Note(name_to_pitch(n.name), n.position, n.velocity, n.duration, n.channel)

function Base.show(io::IO, note::NamedNote)
nn = rpad(note.name, 3)
Expand Down
6 changes: 3 additions & 3 deletions test/namednote_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using Test, MusicManipulations
@test nns[2].name == "D♭5"
@test nns[3].name == "E4"

cn = Note("C#4")
nn3 = NamedNote(cn)
@test nn3.name == "C♯4"
@test NamedNote(Note("C#4")) == NamedNote(Note("Db4"))

@test Note(NamedNote("C#4")) == Note(NamedNote("Db4"))
end

0 comments on commit c10f3a8

Please sign in to comment.