Skip to main content
Glama
emicklei

melrōse musical expression player

by emicklei
multiply_test.go1.18 kB
package calc import ( "reflect" "testing" "github.com/emicklei/melrose/core" ) func TestMultiply_Value(t *testing.T) { type fields struct { Left any Right any } tests := []struct { name string fields fields want any }{ {"3*2", fields{3, 2}, 6}, {"3.0*2.0", fields{3.0, 2.0}, 6.0}, {"3*[2]", fields{3, core.On(2)}, 6}, {"[3]*[2]", fields{core.On(3), core.On(2)}, 6}, {"[[3]]*[2]", fields{core.ValueHolder{Any: core.On(3)}, core.On(2)}, 6}, {"3*nil", fields{3, nil}, 0}, {"nil*2", fields{nil, 2}, 0}, {"3.0*nil", fields{3.0, nil}, 0.0}, {"nil*2.0", fields{nil, 2.0}, 0.0}, {"nil*nil", fields{nil, nil}, 0}, {"3.0*2", fields{3.0, 2}, 6.0}, {"3*2.0", fields{3, 2.0}, 6.0}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { a := Multiply{ Left: tt.fields.Left, Right: tt.fields.Right, } if got := a.Value(); !reflect.DeepEqual(got, tt.want) { t.Errorf("Multiply.Value() = %v, want %v", got, tt.want) } }) } } func TestMultiply_Storex(t *testing.T) { m := Multiply{Left: 1, Right: 2} if got, want := m.Storex(), "1 * 2"; got != want { t.Errorf("got [%v] want [%v]", got, want) } }

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