Added tests for new base command

This commit is contained in:
Keith Jones 2004-02-07 20:44:14 +00:00
parent 4d296473e5
commit ab26fbdf84

View File

@ -35,6 +35,31 @@ class MathTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Math',) plugins = ('Math',)
def testBase(self): def testBase(self):
self.assertNotRegexp('base 56 asdflkj', 'ValueError') self.assertNotRegexp('base 56 asdflkj', 'ValueError')
self.assertResponse('base 16 2 F', '1111')
self.assertResponse('base 2 16 1111', 'F')
self.assertResponse('base 20 BBBB', '92631')
self.assertResponse('base 10 20 92631', 'BBBB')
self.assertResponse('base 2 36 10', '2')
self.assertResponse('base 36 2 10', '100100')
self.assertResponse('base 2 1010101', '85')
self.assertResponse('base 2 2 11', '11')
self.assertResponse('base 2 10 [base 10 2 12]', '12')
self.assertResponse('base 16 2 [base 2 16 110101]', '110101')
self.assertResponse('base 10 8 [base 8 76532]', '76532')
self.assertResponse('base 10 36 [base 36 csalnwea]', 'CSALNWEA')
self.assertResponse('base 5 4 [base 4 5 212231]', '212231')
self.assertRegexp('base 37 1', 'between 2 and 36')
self.assertRegexp('base 1 1', 'between 2 and 36')
self.assertRegexp('base 12 1 1', 'between 2 and 36')
self.assertRegexp('base 1 12 1', 'between 2 and 36')
self.assertRegexp('base 1.0 12 1', 'between 2 and 36')
self.assertRegexp('base A 1', 'between 2 and 36')
self.assertRegexp('base 4 4', 'Invalid <number>')
self.assertRegexp('base 10 12 A', 'Invalid <number>')
def testCalc(self): def testCalc(self):
self.assertResponse('calc 5*0.06', str(5*0.06)) self.assertResponse('calc 5*0.06', str(5*0.06))