Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/interfaces/tests.py
4036 views
1
"""
2
TESTS:
3
4
We test coercions:
5
6
sage: 2 * gp('2')
7
4
8
sage: a = 2 * gp('2'); a
9
4
10
sage: parent(a)
11
PARI/GP interpreter
12
sage: a = 2 * gap('2'); a
13
4
14
sage: parent(a)
15
Gap
16
sage: a = 2 * maxima('2'); a
17
4
18
sage: parent(a)
19
Maxima
20
"""
21
22
#
23
# THIS IS BROKEN (2007-10-04):
24
#
25
#sage: a = 2 * singular('2'); a # seg faults
26
#4
27
#sage: parent(a)
28
#Singular
29
#
30
31
32
from all import *
33
from sage.misc.misc import cputime, walltime
34
import sys
35
36
def manyvars(s, num=70000, inlen=1, step=2000):
37
"""
38
Test that > 65,000 variable names works in each system.
39
"""
40
print "Testing -- %s"%s
41
t = '"%s"'%('9'*int(inlen))
42
try:
43
t = cputime()
44
w = walltime()
45
v = []
46
for i in range(num):
47
if i%step==0:
48
sys.stdout.write('%s '%i)
49
sys.stdout.flush()
50
v.append(s(t))
51
print '\nsuccess -- time = cpu: %s, wall: %s'%(cputime(t), walltime(w))
52
except:
53
print "%s -- failed!"%s
54
55
def manyvars_all(num=70000):
56
#for s in [gap, gp, singular, kash, magma, octave, maxima, mathematica]:
57
for s in [kash, magma, octave, maxima, mathematica]:
58
manyvars(s, num)
59
60
# bad: maple -- infinite loop -- exception pexpect.EOF: <pexpect.EOF instance at 0xb091250c> in ignored
61
62
def manyvars_all2(num=70000):
63
for s in [singular, maxima, mathematica, octave]:
64
manyvars(s, num)
65
66