mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 10:34:19 +01:00
Added abs to the calc command.
This commit is contained in:
parent
b133e59af4
commit
f4f25ef72c
@ -129,6 +129,7 @@ class Math(callbacks.Privmsg):
|
||||
else:
|
||||
return math.sqrt(x)
|
||||
_mathEnv['sqrt'] = _sqrt
|
||||
_mathEnv['abs'] = abs
|
||||
_mathRe = re.compile(r'((?:(?<![A-Fa-f\d)])-)?'
|
||||
r'(?:0x[A-Fa-f\d]+|'
|
||||
r'0[0-7]+|'
|
||||
|
@ -175,6 +175,12 @@ class MathTestCase(PluginTestCase, PluginDocumentation):
|
||||
self.assertNotError('units mass')
|
||||
self.assertNotError('units flux density')
|
||||
|
||||
def testAbs(self):
|
||||
self.assertResponse('calc abs(2)', '2')
|
||||
self.assertResponse('calc abs(-2)', '2')
|
||||
self.assertResponse('calc abs(2.0)', '2')
|
||||
self.assertResponse('calc abs(-2.0)', '2')
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user