(t *testing.T)
| 86 | } |
| 87 | |
| 88 | func TestProcessBinary(t *testing.T) { |
| 89 | tests := []struct { |
| 90 | in *mathTree |
| 91 | out types.Val |
| 92 | }{ |
| 93 | {in: &mathTree{ |
| 94 | Fn: "+", |
| 95 | Child: []*mathTree{ |
| 96 | {Const: types.Val{Tid: types.IntID, Value: int64(2)}}, |
| 97 | {Const: types.Val{Tid: types.IntID, Value: int64(2)}}, |
| 98 | }}, |
| 99 | out: types.Val{Tid: types.IntID, Value: int64(4)}, |
| 100 | }, |
| 101 | {in: &mathTree{ |
| 102 | Fn: "+", |
| 103 | Child: []*mathTree{ |
| 104 | {Const: types.Val{Tid: types.FloatID, Value: float64(2)}}, |
| 105 | {Const: types.Val{Tid: types.IntID, Value: int64(2)}}, |
| 106 | }}, |
| 107 | out: types.Val{Tid: types.FloatID, Value: float64(4)}, |
| 108 | }, |
| 109 | {in: &mathTree{ |
| 110 | Fn: "+", |
| 111 | Child: []*mathTree{ |
| 112 | {Const: types.Val{Tid: types.FloatID, Value: float64(2)}}, |
| 113 | {Const: types.Val{Tid: types.FloatID, Value: float64(2)}}, |
| 114 | }}, |
| 115 | out: types.Val{Tid: types.FloatID, Value: float64(4)}, |
| 116 | }, |
| 117 | {in: &mathTree{ |
| 118 | Fn: "+", |
| 119 | Child: []*mathTree{ |
| 120 | {Const: types.Val{Tid: types.IntID, Value: int64(48038396025285290)}}, |
| 121 | {Const: types.Val{Tid: types.IntID, Value: int64(2)}}, |
| 122 | }}, |
| 123 | out: types.Val{Tid: types.IntID, Value: int64(48038396025285292)}, |
| 124 | }, |
| 125 | {in: &mathTree{ |
| 126 | Fn: "-", |
| 127 | Child: []*mathTree{ |
| 128 | {Const: types.Val{Tid: types.IntID, Value: int64(100)}}, |
| 129 | {Const: types.Val{Tid: types.IntID, Value: int64(1)}}, |
| 130 | }}, |
| 131 | out: types.Val{Tid: types.IntID, Value: int64(99)}, |
| 132 | }, |
| 133 | {in: &mathTree{ |
| 134 | Fn: "-", |
| 135 | Child: []*mathTree{ |
| 136 | {Const: types.Val{Tid: types.FloatID, Value: float64(100)}}, |
| 137 | {Const: types.Val{Tid: types.IntID, Value: int64(1)}}, |
| 138 | }}, |
| 139 | out: types.Val{Tid: types.FloatID, Value: float64(99)}, |
| 140 | }, |
| 141 | {in: &mathTree{ |
| 142 | Fn: "-", |
| 143 | Child: []*mathTree{ |
| 144 | {Const: types.Val{Tid: types.FloatID, Value: float64(100)}}, |
| 145 | {Const: types.Val{Tid: types.FloatID, Value: float64(1)}}, |
nothing calls this directly
no test coverage detected
searching dependent graphs…