Read repeated point spellings in a fixed order and end comments at a carriage return
Two spellings of one curve point, as v064 and v64, now give the same result each time. A line comment ends at a lone carriage return, as in sfizz. Header.Set's documentation says an include in the header's range can override what it sets. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -172,3 +172,32 @@ func TestDefineValueIsOneWord(t *testing.T) {
|
||||
t.Errorf("SetDefine: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TestTwoSpellingsOfOnePoint checks that two spellings of one velocity or
|
||||
// curve point read the same way every time (choice: the one that sorts last
|
||||
// wins).
|
||||
func TestTwoSpellingsOfOnePoint(t *testing.T) {
|
||||
for i := 0; i < 50; i++ {
|
||||
inst := parseText(t, "<region> sample=a.wav amp_velcurve_064=0.2 amp_velcurve_64=0.9")
|
||||
for _, p := range inst.Regions[0].VelocityCurve {
|
||||
if p.Velocity == 64 && p.Gain != 0.9 {
|
||||
t.Fatalf("velocity point %v", p)
|
||||
}
|
||||
}
|
||||
_, stops := readCurves([]Opcodes{{"curve_index": "20", "v064": "0.2", "v64": "0.9"}})
|
||||
for _, s := range stops[20] {
|
||||
if s.At == 64 && s.Value != 0.9 {
|
||||
t.Fatalf("curve point %v", s)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestCommentEndsAtCarriageReturn checks that a line comment ends at a lone
|
||||
// carriage return (sfizz).
|
||||
func TestCommentEndsAtCarriageReturn(t *testing.T) {
|
||||
r := parseText(t, "<region> // note\rsample=a.wav").Regions[0]
|
||||
if r.Sample != "a.wav" {
|
||||
t.Errorf("sample %q", r.Sample)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user