source: git/modules/openmath/tests/basic1.py @ 2acd2e

spielwiese
Last change on this file since 2acd2e was 2acd2e, checked in by Michael Brickenstein <bricken@…>, 18 years ago
*bricken: +testing git-svn-id: file:///usr/local/Singular/svn/trunk@9006 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.1 KB
Line 
1import unittest
2from objects import *
3from context import Context
4
5from cd.arith1 import implementation as arith1
6
7class OMTestCase1(unittest.TestCase):
8            def assertResult(self,expression, result):
9                self.assertEqual(context.evaluate(expression),result)
10            def testAddition(self):
11                expr=OMA(arith1.plus,[2,3])
12                self.assertEqual(len(expr.args),2)
13                self.assertResult(expr,5)
14            def testMultiplication(self):
15                expr=OMA(arith1.times,[4,3])
16                self.assertResult(expr,12)
17            def testPower(self):
18                expr=OMA(arith1.power,[2,3])
19                self.assertResult(expr,8)
20            def testAbs(self):
21                expr=OMA(arith1.abs,[-349])
22                self.assertResult(expr,349)
23            #def testSub(self):
24            #    expr=OMA(arith1.minus,[2,3])
25            #    self.assertResult(expr,-1)
26               
27               
28if __name__=='__main__':
29    context=Context()
30    context.addCDImplementation(arith1)
31    unittest.main()
Note: See TracBrowser for help on using the repository browser.