(t *testing.T)
| 94 | } |
| 95 | |
| 96 | func 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 | |
| 124 | func TestValue_Modulo(t *testing.T) { |
| 125 | run := func(a, b *model.Value, exp *model.Value) func(*testing.T) { |
nothing calls this directly
no test coverage detected