source: git/dyn_modules/openmath/tester.py @ 6ce030f

fieker-DuValspielwiese
Last change on this file since 6ce030f was 3c473c, checked in by Kai Krüger <krueger@…>, 14 years ago
rename directory modules to dyn_modules anticipating "modules" directory for cmake. git-svn-id: file:///usr/local/Singular/svn/trunk@13033 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 953 bytes
Line 
1from context import Context
2from objects import *
3context = Context()
4
5#context.push({})
6print OMV("x")
7print OMA(OMV("x"),[OMV("y"),1])
8
9
10#from binding import OMBinding, lambdasym
11
12
13context["x"] = 1
14
15x = OMV("x")
16
17y = OMV("y")
18
19print context.evaluate(x)
20print context.evaluateVariable(x)
21print context.evaluate(y)
22import cd.arith1 as arith1
23context.addCDImplementation(arith1.implementation)
24def test(expr):
25    print "Original: ", expr
26    print "Evaluated: ", context.evaluate(expr)
27test(OMA(arith1.implementation.plus, [1,2]))
28test(OMA(arith1.implementation.unary_minus, [10]))
29test(OMA(arith1.implementation.times, [3,4]))
30test(OMA(arith1.implementation.abs, [-123]))
31print context.evaluate(OMA(arith1.implementation.plus, [1,2]))
32application = OMA(OMS("plus", arith1.content), [1,2])
33
34print context.evaluate(application)
35firstArg=OMBIND(lambdasym,[OMV("x"), OMV("y")], OMV("x"))
36#print context.evaluate(firstArg)
37test(OMA(firstArg, [37,777777]))
38
Note: See TracBrowser for help on using the repository browser.