mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Added test for rpn 2 degrees and fixed rpn to pass it.
This commit is contained in:
parent
33cd4aa908
commit
f706191201
@ -166,7 +166,10 @@ class Math(callbacks.Privmsg):
|
|||||||
stack = []
|
stack = []
|
||||||
for arg in args:
|
for arg in args:
|
||||||
try:
|
try:
|
||||||
stack.append(complex(arg))
|
x = complex(arg)
|
||||||
|
if x == abs(x):
|
||||||
|
x = abs(x)
|
||||||
|
stack.append(x)
|
||||||
except ValueError: # Not a float.
|
except ValueError: # Not a float.
|
||||||
if arg in self._mathEnv:
|
if arg in self._mathEnv:
|
||||||
f = self._mathEnv[arg]
|
f = self._mathEnv[arg]
|
||||||
|
@ -49,6 +49,7 @@ class MathTestCase(PluginTestCase, PluginDocumentation):
|
|||||||
self.assertResponse('rpn 1 2 3 +', 'Stack: [1, 5]')
|
self.assertResponse('rpn 1 2 3 +', 'Stack: [1, 5]')
|
||||||
self.assertResponse('rpn 1 dup', 'Stack: [1, 1]')
|
self.assertResponse('rpn 1 dup', 'Stack: [1, 1]')
|
||||||
self.assertResponse('rpn 2 3 4 + -', str(2-7))
|
self.assertResponse('rpn 2 3 4 + -', str(2-7))
|
||||||
|
self.assertNotError('rpn 2 degrees')
|
||||||
|
|
||||||
def testConvert(self):
|
def testConvert(self):
|
||||||
self.assertResponse('convert 1 m to cm', '100.0 cm')
|
self.assertResponse('convert 1 m to cm', '100.0 cm')
|
||||||
|
Loading…
Reference in New Issue
Block a user