MCPcopy
hub / github.com/TomWright/dasel / TestValue_Modulo

Function TestValue_Modulo

model/value_math_test.go:124–150  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

122}
123
124func TestValue_Modulo(t *testing.T) {
125 run := func(a, b *model.Value, exp *model.Value) func(*testing.T) {
126 return func(t *testing.T) {
127 got, err := a.Modulo(b)
128 if err != nil {
129 t.Errorf("unexpected error: %s", err)
130 return
131 }
132 eq, err := got.EqualTypeValue(exp)
133 if err != nil {
134 t.Errorf("unexpected error: %s", err)
135 return
136 }
137 if !eq {
138 t.Errorf("expected %v, got %v", exp, got)
139 }
140 }
141 }
142 t.Run("int", func(t *testing.T) {
143 t.Run("int", run(model.NewIntValue(10), model.NewIntValue(3), model.NewIntValue(1)))
144 t.Run("float", run(model.NewIntValue(10), model.NewFloatValue(3), model.NewFloatValue(1)))
145 })
146 t.Run("float", func(t *testing.T) {
147 t.Run("int", run(model.NewFloatValue(10), model.NewIntValue(3), model.NewFloatValue(1)))
148 t.Run("float", run(model.NewFloatValue(10), model.NewFloatValue(3), model.NewFloatValue(1)))
149 })
150}

Callers

nothing calls this directly

Calls 6

NewIntValueFunction · 0.92
NewFloatValueFunction · 0.92
runFunction · 0.85
ModuloMethod · 0.80
EqualTypeValueMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected