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

Function TestValue_Divide

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

Source from the content-addressed store, hash-verified

94}
95
96func TestValue_Divide(t *testing.T) {
97 run := func(a, b *model.Value, exp *model.Value) func(*testing.T) {
98 return func(t *testing.T) {
99 got, err := a.Divide(b)
100 if err != nil {
101 t.Errorf("unexpected error: %s", err)
102 return
103 }
104 eq, err := got.EqualTypeValue(exp)
105 if err != nil {
106 t.Errorf("unexpected error: %s", err)
107 return
108 }
109 if !eq {
110 t.Errorf("expected %v, got %v", exp, got)
111 }
112 }
113 }
114 t.Run("int", func(t *testing.T) {
115 t.Run("int", run(model.NewIntValue(6), model.NewIntValue(2), model.NewIntValue(3)))
116 t.Run("float", run(model.NewIntValue(6), model.NewFloatValue(2), model.NewFloatValue(3)))
117 })
118 t.Run("float", func(t *testing.T) {
119 t.Run("int", run(model.NewFloatValue(6), model.NewIntValue(2), model.NewFloatValue(3)))
120 t.Run("float", run(model.NewFloatValue(6), model.NewFloatValue(2), model.NewFloatValue(3)))
121 })
122}
123
124func TestValue_Modulo(t *testing.T) {
125 run := func(a, b *model.Value, exp *model.Value) func(*testing.T) {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected