File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,22 @@ type evalErrorTest struct {
2121 err string
2222}
2323
24+ type evalParams map [string ]interface {}
25+
26+ func (p evalParams ) Max (a , b float64 ) float64 {
27+ if a < b {
28+ return b
29+ }
30+ return a
31+ }
32+
33+ func (p evalParams ) Min (a , b float64 ) float64 {
34+ if a < b {
35+ return a
36+ }
37+ return b
38+ }
39+
2440var evalTests = []evalTest {
2541 {
2642 "foo" ,
@@ -339,6 +355,16 @@ var evalTests = []evalTest{
339355 map [string ]interface {}{"foo" : func (in string ) string { return "hello " + in }},
340356 "hello world" ,
341357 },
358+ {
359+ "Max(a, b)" ,
360+ evalParams {"a" : 1.23 , "b" : 3.21 },
361+ 3.21 ,
362+ },
363+ {
364+ "Min(a, b)" ,
365+ evalParams {"a" : 1.23 , "b" : 3.21 },
366+ 1.23 ,
367+ },
342368}
343369
344370var evalErrorTests = []evalErrorTest {
You can’t perform that action at this time.
0 commit comments