Skip to content

Commit

Permalink
Merge 74233a0 into 76ed3cc
Browse files Browse the repository at this point in the history
  • Loading branch information
mlin committed Sep 27, 2020
2 parents 76ed3cc + 74233a0 commit 5128c9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions WDL/StdLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def __init__(self, write_dir: str = ""):
self._lte = _ComparisonOperator("<=", lambda l, r: l <= r)
self._gt = _ComparisonOperator(">", lambda l, r: l > r)
self._gte = _ComparisonOperator(">=", lambda l, r: l >= r)
self.min = _ArithmeticOperator("min", lambda l, r: min(l, r))
self.max = _ArithmeticOperator("max", lambda l, r: max(l, r))

# static stdlib functions
def static(
Expand Down
5 changes: 4 additions & 1 deletion tests/test_0eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ def test_arithmetic(self):
("1--4/3","3"), # -4/3 == -2, is this right?
("4%2","0"),
("4%3","1"),
("1 + false", "(Ln 1, Col 1) Non-numeric operand to + operator", WDL.Error.IncompatibleOperand)
("min(0,1)","0"),
("max(1,3.14)*2","6.28"),
("1 + false", "(Ln 1, Col 1) Non-numeric operand to + operator", WDL.Error.IncompatibleOperand),
("min(max(0,1),true)", "(Ln 1, Col 1) Non-numeric operand to min operator", WDL.Error.IncompatibleOperand),
)

def test_cmp(self):
Expand Down

0 comments on commit 5128c9e

Please sign in to comment.