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 {
21
21
err string
22
22
}
23
23
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
+
24
40
var evalTests = []evalTest {
25
41
{
26
42
"foo" ,
@@ -339,6 +355,16 @@ var evalTests = []evalTest{
339
355
map [string ]interface {}{"foo" : func (in string ) string { return "hello " + in }},
340
356
"hello world" ,
341
357
},
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
+ },
342
368
}
343
369
344
370
var evalErrorTests = []evalErrorTest {
You can’t perform that action at this time.
0 commit comments