mirror of
https://github.com/alda-lang/alda.git
synced 2026-03-03 18:23:36 +01:00
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package parser
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"alda.io/client/model"
|
|
_ "alda.io/client/testing"
|
|
)
|
|
|
|
func TestCram(t *testing.T) {
|
|
executeParseTestCases(
|
|
t,
|
|
parseTestCase{
|
|
label: "cram expression",
|
|
given: "{c d e}",
|
|
expect: []model.ScoreUpdate{
|
|
model.Cram{
|
|
Events: []model.ScoreUpdate{
|
|
model.Note{Pitch: model.LetterAndAccidentals{NoteLetter: model.C}},
|
|
model.Note{Pitch: model.LetterAndAccidentals{NoteLetter: model.D}},
|
|
model.Note{Pitch: model.LetterAndAccidentals{NoteLetter: model.E}},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
parseTestCase{
|
|
label: "cram expression with specified duration",
|
|
given: "{c d e}2",
|
|
expect: []model.ScoreUpdate{
|
|
model.Cram{
|
|
Events: []model.ScoreUpdate{
|
|
model.Note{Pitch: model.LetterAndAccidentals{NoteLetter: model.C}},
|
|
model.Note{Pitch: model.LetterAndAccidentals{NoteLetter: model.D}},
|
|
model.Note{Pitch: model.LetterAndAccidentals{NoteLetter: model.E}},
|
|
},
|
|
Duration: model.Duration{
|
|
Components: []model.DurationComponent{
|
|
model.NoteLength{Denominator: 2},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
)
|
|
}
|