Added max and min.

This commit is contained in:
Jeremy Fincher 2004-09-15 16:17:03 +00:00
parent f53d3d5934
commit 00889cc390
2 changed files with 6 additions and 0 deletions

View File

@ -130,6 +130,8 @@ class Math(callbacks.Privmsg):
return math.sqrt(x)
_mathEnv['sqrt'] = _sqrt
_mathEnv['abs'] = abs
_mathEnv['max'] = max
_mathEnv['min'] = min
_mathRe = re.compile(r'((?:(?<![A-Fa-f\d)])-)?'
r'(?:0x[A-Fa-f\d]+|'
r'0[0-7]+|'

View File

@ -124,6 +124,10 @@ class MathTestCase(PluginTestCase, PluginDocumentation):
def testCaseInsensitive(self):
self.assertNotError('calc PI**PI')
def testCalcMaxMin(self):
self.assertResponse('calc max(1,2)', '2')
self.assertResponse('calc min(1,2)', '1')
def testICalc(self):
self.assertResponse('icalc 1^1', '0')
self.assertResponse('icalc 10**24', '1' + '0'*24)