Skip to main content
Glama
emicklei

melrōse musical expression player

by emicklei
joinmap_test.go2.15 kB
package op import ( "testing" "github.com/emicklei/melrose/core" ) func TestJoinMapper_S(t *testing.T) { j := Join{Target: []core.Sequenceable{core.MustParseNote("c"), core.MustParseNote("d")}} m := NewJoinMap(core.On(j), core.On("(1 2) 1")) if got, want := m.Storex(), "joinmap('(1 2) 1',join(note('C'),note('D')))"; got != want { t.Errorf("got [%v] want [%v]", got, want) } } func TestJoinMapperWithIterator(t *testing.T) { j := Join{Target: []core.Sequenceable{core.MustParseNote("c"), core.MustParseNote("d")}} i := &core.Iterator{Target: []any{"1 2"}} m := NewJoinMap(core.On(j), i) if got, want := m.Storex(), "joinmap('1 2',join(note('C'),note('D')))"; got != want { t.Errorf("got [%v] want [%v]", got, want) } } func TestJoinMap_S(t *testing.T) { j := Join{Target: []core.Sequenceable{core.MustParseNote("c"), core.MustParseNote("d")}} m := NewJoinMap(core.On(j), core.On("(1 2) 1")) if got, want := m.S().Storex(), "sequence('(C D) C')"; got != want { t.Errorf("got [%v] want [%v]", got, want) } m = NewJoinMap(core.On(core.S("a b")), core.On("1")) if got, want := m.S().Storex(), "sequence('')"; got != want { t.Errorf("got [%v] want [%v]", got, want) } m = NewJoinMap(core.On(j), core.On("3")) if got, want := m.S().Storex(), "sequence('=')"; got != want { t.Errorf("got [%v] want [%v]", got, want) } m = NewJoinMap(core.On(j), core.On("(1 3)")) if got, want := m.S().Storex(), "sequence('(C =)')"; got != want { t.Errorf("got [%v] want [%v]", got, want) } } func TestJoinMap_Replaced(t *testing.T) { j := Join{Target: []core.Sequenceable{core.MustParseNote("c"), core.MustParseNote("d")}} m := NewJoinMap(core.On(j), core.On("(1 2) 1")) if core.IsIdenticalTo(m, j) { t.Error("should not be identical") } if !core.IsIdenticalTo(m.Replaced(j, core.EmptySequence).(JoinMap).target.Value().(core.Sequenceable), core.EmptySequence) { t.Error("not replaced") } if !core.IsIdenticalTo(m.Replaced(m, j), j) { t.Error("should be replaced by j") } m = NewJoinMap(core.On(core.S("a b")), core.On("1")) if !core.IsIdenticalTo(m.Replaced(m, j), j) { t.Error("should be replaced by j") } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/emicklei/melrose'

If you have feedback or need assistance with the MCP directory API, please join our Discord server