mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-31 22:54:08 +01:00
Added max and min.
This commit is contained in:
parent
f53d3d5934
commit
00889cc390
@ -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]+|'
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user