Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/sage/libs/gap/test_long.py
8815 views
1
"""
2
Long tests for libGAP
3
4
These stress test the garbage collection inside GAP
5
"""
6
7
from sage.libs.all import libgap
8
9
10
def test_loop_1():
11
"""
12
EXAMPLES::
13
14
sage: from sage.libs.gap.test_long import test_loop_1
15
sage: test_loop_1() # long time (up to 25s on sage.math, 2013)
16
"""
17
libgap.collect()
18
for i in range(10000):
19
G = libgap.CyclicGroup(2)
20
21
22
def test_loop_2():
23
"""
24
EXAMPLES::
25
26
sage: from sage.libs.gap.test_long import test_loop_2
27
sage: test_loop_2() # long time (10s on sage.math, 2013)
28
"""
29
G =libgap.FreeGroup(2)
30
a,b = G.GeneratorsOfGroup()
31
for i in range(100):
32
rel = libgap([a**2, b**2, a*b*a*b])
33
H = G / rel
34
H1 = H.GeneratorsOfGroup()[0]
35
n = H1.Order()
36
assert n.sage() == 2
37
38
for i in range(300000):
39
n = libgap.Order(H1)
40
41
42
def test_loop_3():
43
"""
44
EXAMPLES::
45
46
sage: from sage.libs.gap.test_long import test_loop_3
47
sage: test_loop_3() # long time (31s on sage.math, 2013)
48
"""
49
G = libgap.FreeGroup(2)
50
(a,b) = G.GeneratorsOfGroup()
51
for i in range(300000):
52
lis=libgap([])
53
lis.Add(a ** 2)
54
lis.Add(b ** 2)
55
lis.Add(b * a)
56
57
58
59
60