summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMax Horn <max@quendi.de>2022-08-19 22:19:14 +0200
committerGitHub <noreply@github.com>2022-08-19 22:19:14 +0200
commitf4976545a11bb126cf201b5942f543359a03cc58 (patch)
tree385e265bc62499f1fe447cc460d6eef0793d6532 /tests
parentadb90dc65f2f211675af5be27d2a7efdf96c6f44 (diff)
downloadpygments-git-f4976545a11bb126cf201b5942f543359a03cc58.tar.gz
Add GAP console session mode (#2211)
* Add GAP console session mode This is also appropriate for GAP .tst files. Add `analyse_text` methods for `ScilabLexer` and `GAPConsoleLexer` to distinguish Scilab and GAP .tst files * Use explicit name for 'keepends' argument to splitlines
Diffstat (limited to 'tests')
-rw-r--r--tests/examplefiles/gap-repl/euclidean.tst60
-rw-r--r--tests/examplefiles/gap-repl/euclidean.tst.output838
-rw-r--r--tests/examplefiles/gap-repl/magma.tst58
-rw-r--r--tests/examplefiles/gap-repl/magma.tst.output694
-rw-r--r--tests/examplefiles/scilab/bench_chol.tst23
-rw-r--r--tests/examplefiles/scilab/bench_chol.tst.output95
6 files changed, 1768 insertions, 0 deletions
diff --git a/tests/examplefiles/gap-repl/euclidean.tst b/tests/examplefiles/gap-repl/euclidean.tst
new file mode 100644
index 00000000..ca3b3285
--- /dev/null
+++ b/tests/examplefiles/gap-repl/euclidean.tst
@@ -0,0 +1,60 @@
+#@local checkEuclideanRing
+gap> START_TEST("euclidean.tst");
+
+# test consistency of EuclideanDegree, EuclideanQuotient, EuclideanRemainder,
+# and QuotientRemainder for some ring and elements of it
+gap> checkEuclideanRing :=
+> function(R, colls...)
+> local coll1, coll2, a, b, deg_b, deg_r, q, r, qr;
+> if Length(colls) >= 1 then coll1:=colls[1];
+> elif Size(R) <= 100 then coll1 := R;
+> else coll1 := List([1..100],i->Random(R));
+> fi;
+> if Length(colls) >= 2 then coll2:=colls[2];
+> elif Size(R) <= 100 then coll2 := R;
+> else coll2 := List([1..100],i->Random(R));
+> fi;
+> for b in coll1 do
+> if IsZero(b) then continue; fi;
+> deg_b := EuclideanDegree(R, b);
+> for a in coll2 do
+> q := EuclideanQuotient(R, a, b); Assert(0, q in R);
+> r := EuclideanRemainder(R, a, b); Assert(0, r in R);
+> if a <> q*b + r then Error("a <> q*b + r for ", [R,a,b]); fi;
+> deg_r := EuclideanDegree(R, r);
+> if not IsZero(r) and deg_r >= deg_b then Error("Euclidean degree did not decrease for ",[R,a,b]); fi;
+> qr := QuotientRemainder(R, a, b);
+> if qr <> [q, r] then Error("QuotientRemainder inconsistent for ", [R,a,b]); fi;
+> od;
+> od;
+> return true;
+> end;;
+
+# rings in characteristic 0
+gap> checkEuclideanRing(Integers,[-100..100],[-100..100]);
+true
+gap> checkEuclideanRing(Rationals);
+true
+gap> checkEuclideanRing(GaussianIntegers);
+true
+gap> checkEuclideanRing(GaussianRationals);
+true
+
+# finite fields
+gap> ForAll(Filtered([2..50], IsPrimePowerInt), q->checkEuclideanRing(GF(q)));
+true
+
+# ZmodnZ
+gap> ForAll([1..50], m -> checkEuclideanRing(Integers mod m));
+true
+gap> checkEuclideanRing(Integers mod ((2*3*5)^2));
+true
+gap> checkEuclideanRing(Integers mod ((2*3*5)^3));
+true
+gap> checkEuclideanRing(Integers mod ((2*3*5*7)^2));
+true
+gap> checkEuclideanRing(Integers mod ((2*3*5*7)^3));
+true
+
+#
+gap> STOP_TEST( "euclidean.tst", 1);
diff --git a/tests/examplefiles/gap-repl/euclidean.tst.output b/tests/examplefiles/gap-repl/euclidean.tst.output
new file mode 100644
index 00000000..17eafe60
--- /dev/null
+++ b/tests/examplefiles/gap-repl/euclidean.tst.output
@@ -0,0 +1,838 @@
+'#@local checkEuclideanRing\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'START_TEST' Name.Variable
+'(' Punctuation
+'"euclidean.tst"' Literal.String
+')' Punctuation
+';' Operator
+'\n' Text
+
+'\n' Generic.Output
+
+'# test consistency of EuclideanDegree, EuclideanQuotient, EuclideanRemainder,\n' Generic.Output
+
+'# and QuotientRemainder for some ring and elements of it\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'checkEuclideanRing' Name.Variable
+' ' Text
+':=' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+'function' Keyword
+'(' Punctuation
+'R' Name.Variable
+',' Operator
+' ' Text
+'colls' Name.Variable
+'.' Operator
+'.' Operator
+'.' Operator
+')' Punctuation
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'local' Keyword
+' ' Text
+'coll1' Name.Variable
+',' Operator
+' ' Text
+'coll2' Name.Variable
+',' Operator
+' ' Text
+'a' Name.Variable
+',' Operator
+' ' Text
+'b' Name.Variable
+',' Operator
+' ' Text
+'deg_b' Name.Variable
+',' Operator
+' ' Text
+'deg_r' Name.Variable
+',' Operator
+' ' Text
+'q' Name.Variable
+',' Operator
+' ' Text
+'r' Name.Variable
+',' Operator
+' ' Text
+'qr' Name.Variable
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'if' Keyword
+' ' Text
+'Length' Name.Variable
+'(' Punctuation
+'colls' Name.Variable
+')' Punctuation
+' ' Text
+'>' Operator
+'=' Operator
+' ' Text
+'1' Name.Variable
+' ' Text
+'then' Keyword
+' ' Text
+'coll1' Name.Variable
+':=' Operator
+'colls' Name.Variable
+'[' Punctuation
+'1' Name.Variable
+']' Punctuation
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'elif' Keyword
+' ' Text
+'Size' Name.Variable
+'(' Punctuation
+'R' Name.Variable
+')' Punctuation
+' ' Text
+'<' Operator
+'=' Operator
+' ' Text
+'100' Name.Variable
+' ' Text
+'then' Keyword
+' ' Text
+'coll1' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'R' Name.Variable
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'else' Keyword
+' ' Text
+'coll1' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'List' Name.Variable
+'(' Punctuation
+'[' Punctuation
+'1' Name.Variable
+'.' Operator
+'.' Operator
+'100' Name.Variable
+']' Punctuation
+',' Operator
+'i' Name.Variable
+'-' Operator
+'>' Operator
+'Random' Name.Variable
+'(' Punctuation
+'R' Name.Variable
+')' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'fi' Keyword
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'if' Keyword
+' ' Text
+'Length' Name.Variable
+'(' Punctuation
+'colls' Name.Variable
+')' Punctuation
+' ' Text
+'>' Operator
+'=' Operator
+' ' Text
+'2' Name.Variable
+' ' Text
+'then' Keyword
+' ' Text
+'coll2' Name.Variable
+':=' Operator
+'colls' Name.Variable
+'[' Punctuation
+'2' Name.Variable
+']' Punctuation
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'elif' Keyword
+' ' Text
+'Size' Name.Variable
+'(' Punctuation
+'R' Name.Variable
+')' Punctuation
+' ' Text
+'<' Operator
+'=' Operator
+' ' Text
+'100' Name.Variable
+' ' Text
+'then' Keyword
+' ' Text
+'coll2' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'R' Name.Variable
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'else' Keyword
+' ' Text
+'coll2' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'List' Name.Variable
+'(' Punctuation
+'[' Punctuation
+'1' Name.Variable
+'.' Operator
+'.' Operator
+'100' Name.Variable
+']' Punctuation
+',' Operator
+'i' Name.Variable
+'-' Operator
+'>' Operator
+'Random' Name.Variable
+'(' Punctuation
+'R' Name.Variable
+')' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'fi' Keyword
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'for' Keyword
+' ' Text
+'b' Name.Variable
+' ' Text
+'in' Operator.Word
+' ' Text
+'coll1' Name.Variable
+' ' Text
+'do' Keyword
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'if' Keyword
+' ' Text
+'IsZero' Name.Variable
+'(' Punctuation
+'b' Name.Variable
+')' Punctuation
+' ' Text
+'then' Keyword
+' ' Text
+'continue' Keyword
+';' Operator
+' ' Text
+'fi' Keyword
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'deg_b' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'EuclideanDegree' Name.Variable
+'(' Punctuation
+'R' Name.Variable
+',' Operator
+' ' Text
+'b' Name.Variable
+')' Punctuation
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'for' Keyword
+' ' Text
+'a' Name.Variable
+' ' Text
+'in' Operator.Word
+' ' Text
+'coll2' Name.Variable
+' ' Text
+'do' Keyword
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'q' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'EuclideanQuotient' Name.Variable
+'(' Punctuation
+'R' Name.Variable
+',' Operator
+' ' Text
+'a' Name.Variable
+',' Operator
+' ' Text
+'b' Name.Variable
+')' Punctuation
+';' Operator
+' ' Text
+'Assert' Keyword
+'(' Punctuation
+'0' Name.Variable
+',' Operator
+' ' Text
+'q' Name.Variable
+' ' Text
+'in' Operator.Word
+' ' Text
+'R' Name.Variable
+')' Punctuation
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'r' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'EuclideanRemainder' Name.Variable
+'(' Punctuation
+'R' Name.Variable
+',' Operator
+' ' Text
+'a' Name.Variable
+',' Operator
+' ' Text
+'b' Name.Variable
+')' Punctuation
+';' Operator
+' ' Text
+'Assert' Keyword
+'(' Punctuation
+'0' Name.Variable
+',' Operator
+' ' Text
+'r' Name.Variable
+' ' Text
+'in' Operator.Word
+' ' Text
+'R' Name.Variable
+')' Punctuation
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'if' Keyword
+' ' Text
+'a' Name.Variable
+' ' Text
+'<' Operator
+'>' Operator
+' ' Text
+'q' Name.Variable
+'*' Operator
+'b' Name.Variable
+' ' Text
+'+' Operator
+' ' Text
+'r' Name.Variable
+' ' Text
+'then' Keyword
+' ' Text
+'Error' Name.Variable
+'(' Punctuation
+'"a <> q*b + r for "' Literal.String
+',' Operator
+' ' Text
+'[' Punctuation
+'R' Name.Variable
+',' Operator
+'a' Name.Variable
+',' Operator
+'b' Name.Variable
+']' Punctuation
+')' Punctuation
+';' Operator
+' ' Text
+'fi' Keyword
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'deg_r' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'EuclideanDegree' Name.Variable
+'(' Punctuation
+'R' Name.Variable
+',' Operator
+' ' Text
+'r' Name.Variable
+')' Punctuation
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'if' Keyword
+' ' Text
+'not' Operator.Word
+' ' Text
+'IsZero' Name.Variable
+'(' Punctuation
+'r' Name.Variable
+')' Punctuation
+' ' Text
+'and' Operator.Word
+' ' Text
+'deg_r' Name.Variable
+' ' Text
+'>' Operator
+'=' Operator
+' ' Text
+'deg_b' Name.Variable
+' ' Text
+'then' Keyword
+' ' Text
+'Error' Name.Variable
+'(' Punctuation
+'"Euclidean degree did not decrease for "' Literal.String
+',' Operator
+'[' Punctuation
+'R' Name.Variable
+',' Operator
+'a' Name.Variable
+',' Operator
+'b' Name.Variable
+']' Punctuation
+')' Punctuation
+';' Operator
+' ' Text
+'fi' Keyword
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'qr' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'QuotientRemainder' Name.Variable
+'(' Punctuation
+'R' Name.Variable
+',' Operator
+' ' Text
+'a' Name.Variable
+',' Operator
+' ' Text
+'b' Name.Variable
+')' Punctuation
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'if' Keyword
+' ' Text
+'qr' Name.Variable
+' ' Text
+'<' Operator
+'>' Operator
+' ' Text
+'[' Punctuation
+'q' Name.Variable
+',' Operator
+' ' Text
+'r' Name.Variable
+']' Punctuation
+' ' Text
+'then' Keyword
+' ' Text
+'Error' Name.Variable
+'(' Punctuation
+'"QuotientRemainder inconsistent for "' Literal.String
+',' Operator
+' ' Text
+'[' Punctuation
+'R' Name.Variable
+',' Operator
+'a' Name.Variable
+',' Operator
+'b' Name.Variable
+']' Punctuation
+')' Punctuation
+';' Operator
+' ' Text
+'fi' Keyword
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+' ' Text
+' ' Text
+'od' Keyword
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'od' Keyword
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'return' Keyword
+' ' Text
+'true' Name.Constant
+';' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+'end' Keyword
+';' Operator
+';' Operator
+'\n' Text
+
+'\n' Generic.Output
+
+'# rings in characteristic 0\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'checkEuclideanRing' Name.Variable
+'(' Punctuation
+'Integers' Name.Variable
+',' Operator
+'[' Punctuation
+'-' Operator
+'100' Name.Variable
+'.' Operator
+'.' Operator
+'100' Name.Variable
+']' Punctuation
+',' Operator
+'[' Punctuation
+'-' Operator
+'100' Name.Variable
+'.' Operator
+'.' Operator
+'100' Name.Variable
+']' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'true\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'checkEuclideanRing' Name.Variable
+'(' Punctuation
+'Rationals' Name.Variable
+')' Punctuation
+';' Operator
+'\n' Text
+
+'true\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'checkEuclideanRing' Name.Variable
+'(' Punctuation
+'GaussianIntegers' Name.Variable
+')' Punctuation
+';' Operator
+'\n' Text
+
+'true\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'checkEuclideanRing' Name.Variable
+'(' Punctuation
+'GaussianRationals' Name.Variable
+')' Punctuation
+';' Operator
+'\n' Text
+
+'true\n' Generic.Output
+
+'\n' Generic.Output
+
+'# finite fields\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'ForAll' Name.Variable
+'(' Punctuation
+'Filtered' Name.Variable
+'(' Punctuation
+'[' Punctuation
+'2' Name.Variable
+'.' Operator
+'.' Operator
+'50' Name.Variable
+']' Punctuation
+',' Operator
+' ' Text
+'IsPrimePowerInt' Name.Variable
+')' Punctuation
+',' Operator
+' ' Text
+'q' Name.Variable
+'-' Operator
+'>' Operator
+'checkEuclideanRing' Name.Variable
+'(' Punctuation
+'GF' Name.Variable
+'(' Punctuation
+'q' Name.Variable
+')' Punctuation
+')' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'true\n' Generic.Output
+
+'\n' Generic.Output
+
+'# ZmodnZ\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'ForAll' Name.Variable
+'(' Punctuation
+'[' Punctuation
+'1' Name.Variable
+'.' Operator
+'.' Operator
+'50' Name.Variable
+']' Punctuation
+',' Operator
+' ' Text
+'m' Name.Variable
+' ' Text
+'-' Operator
+'>' Operator
+' ' Text
+'checkEuclideanRing' Name.Variable
+'(' Punctuation
+'Integers' Name.Variable
+' ' Text
+'mod' Operator.Word
+' ' Text
+'m' Name.Variable
+')' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'true\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'checkEuclideanRing' Name.Variable
+'(' Punctuation
+'Integers' Name.Variable
+' ' Text
+'mod' Operator.Word
+' ' Text
+'(' Punctuation
+'(' Punctuation
+'2' Name.Variable
+'*' Operator
+'3' Name.Variable
+'*' Operator
+'5' Name.Variable
+')' Punctuation
+'^' Operator
+'2' Name.Variable
+')' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'true\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'checkEuclideanRing' Name.Variable
+'(' Punctuation
+'Integers' Name.Variable
+' ' Text
+'mod' Operator.Word
+' ' Text
+'(' Punctuation
+'(' Punctuation
+'2' Name.Variable
+'*' Operator
+'3' Name.Variable
+'*' Operator
+'5' Name.Variable
+')' Punctuation
+'^' Operator
+'3' Name.Variable
+')' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'true\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'checkEuclideanRing' Name.Variable
+'(' Punctuation
+'Integers' Name.Variable
+' ' Text
+'mod' Operator.Word
+' ' Text
+'(' Punctuation
+'(' Punctuation
+'2' Name.Variable
+'*' Operator
+'3' Name.Variable
+'*' Operator
+'5' Name.Variable
+'*' Operator
+'7' Name.Variable
+')' Punctuation
+'^' Operator
+'2' Name.Variable
+')' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'true\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'checkEuclideanRing' Name.Variable
+'(' Punctuation
+'Integers' Name.Variable
+' ' Text
+'mod' Operator.Word
+' ' Text
+'(' Punctuation
+'(' Punctuation
+'2' Name.Variable
+'*' Operator
+'3' Name.Variable
+'*' Operator
+'5' Name.Variable
+'*' Operator
+'7' Name.Variable
+')' Punctuation
+'^' Operator
+'3' Name.Variable
+')' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'true\n' Generic.Output
+
+'\n' Generic.Output
+
+'#\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'STOP_TEST' Name.Variable
+'(' Punctuation
+' ' Text
+'"euclidean.tst"' Literal.String
+',' Operator
+' ' Text
+'1' Name.Variable
+')' Punctuation
+';' Operator
+'\n' Text
diff --git a/tests/examplefiles/gap-repl/magma.tst b/tests/examplefiles/gap-repl/magma.tst
new file mode 100644
index 00000000..fac994f8
--- /dev/null
+++ b/tests/examplefiles/gap-repl/magma.tst
@@ -0,0 +1,58 @@
+#@local F,M,T
+gap> START_TEST( "magma.tst" );
+
+#
+gap> M:= MagmaByMultiplicationTable( [ [ 1, 1 ], [ 1, 1 ] ] );;
+gap> IsGeneratorsOfMagmaWithInverses( Elements( M ) );
+false
+
+# IsAssociative and IsCommutative
+gap> T := [
+> [ 2, 4, 3, 4, 5 ],
+> [ 3, 3, 2, 3, 3 ],
+> [ 5, 5, 5, 4, 4 ],
+> [ 5, 1, 4, 1, 1 ],
+> [ 5, 3, 3, 4, 5 ]
+> ];;
+gap> M := MagmaByMultiplicationTable(T);
+<magma with 5 generators>
+gap> IsAssociative(M) or IsCommutative(M);
+false
+gap> Filtered(Combinations(Elements(M)), x -> Size(x) > 0 and IsAssociative(x));
+[ [ m5 ] ]
+gap> Filtered(Combinations(Elements(M)), x -> Size(x) > 0 and IsCommutative(x));
+[ [ m1 ], [ m1, m5 ], [ m2 ], [ m2, m5 ], [ m3 ], [ m3, m4 ], [ m4 ], [ m5 ] ]
+gap> T := [
+> [ 1, 4, 3, 3, 2 ],
+> [ 4, 2, 4, 4, 2 ],
+> [ 3, 4, 3, 4, 1 ],
+> [ 1, 4, 5, 4, 3 ],
+> [ 2, 2, 3, 5, 3 ]
+> ];;
+gap> M := MagmaByMultiplicationTable(T);
+<magma with 5 generators>
+gap> IsAssociative(M) or IsCommutative(M);
+false
+gap> Filtered(Combinations(Elements(M)), x -> Size(x) > 0 and IsAssociative(x));
+[ [ m1 ], [ m1, m3 ], [ m2 ], [ m2, m4 ], [ m3 ], [ m4 ] ]
+gap> AsSemigroup([Elements(M)[1], Elements(M)[2]]);
+fail
+gap> AsSemigroup([Elements(M)[1], Elements(M)[3]]);
+<semigroup of size 2, with 2 generators>
+gap> Filtered(Combinations(Elements(M)), x -> Size(x) > 0 and IsCommutative(x));
+[ [ m1 ], [ m1, m2 ], [ m1, m2, m3 ], [ m1, m2, m5 ], [ m1, m3 ], [ m1, m5 ],
+ [ m2 ], [ m2, m3 ], [ m2, m4 ], [ m2, m5 ], [ m3 ], [ m4 ], [ m5 ] ]
+
+#
+gap> F := Elements( GL(2,2) );;
+gap> IsAssociative( F );
+true
+gap> IsCommutative( F );
+false
+gap> Number( Combinations( F, 3 ), IsCommutative );
+1
+gap> AsSemigroup( F );
+<semigroup of size 6, with 2 generators>
+
+#
+gap> STOP_TEST( "magma.tst" );
diff --git a/tests/examplefiles/gap-repl/magma.tst.output b/tests/examplefiles/gap-repl/magma.tst.output
new file mode 100644
index 00000000..b4de844d
--- /dev/null
+++ b/tests/examplefiles/gap-repl/magma.tst.output
@@ -0,0 +1,694 @@
+'#@local F,M,T\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'START_TEST' Name.Variable
+'(' Punctuation
+' ' Text
+'"magma.tst"' Literal.String
+' ' Text
+')' Punctuation
+';' Operator
+'\n' Text
+
+'\n' Generic.Output
+
+'#\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'M' Name.Variable
+':=' Operator
+' ' Text
+'MagmaByMultiplicationTable' Name.Variable
+'(' Punctuation
+' ' Text
+'[' Punctuation
+' ' Text
+'[' Punctuation
+' ' Text
+'1' Name.Variable
+',' Operator
+' ' Text
+'1' Name.Variable
+' ' Text
+']' Punctuation
+',' Operator
+' ' Text
+'[' Punctuation
+' ' Text
+'1' Name.Variable
+',' Operator
+' ' Text
+'1' Name.Variable
+' ' Text
+']' Punctuation
+' ' Text
+']' Punctuation
+' ' Text
+')' Punctuation
+';' Operator
+';' Operator
+'\n' Text
+
+'gap> ' Generic.Prompt
+'IsGeneratorsOfMagmaWithInverses' Name.Variable
+'(' Punctuation
+' ' Text
+'Elements' Name.Variable
+'(' Punctuation
+' ' Text
+'M' Name.Variable
+' ' Text
+')' Punctuation
+' ' Text
+')' Punctuation
+';' Operator
+'\n' Text
+
+'false\n' Generic.Output
+
+'\n' Generic.Output
+
+'# IsAssociative and IsCommutative\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'T' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'[' Punctuation
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'[' Punctuation
+' ' Text
+'2' Name.Variable
+',' Operator
+' ' Text
+'4' Name.Variable
+',' Operator
+' ' Text
+'3' Name.Variable
+',' Operator
+' ' Text
+'4' Name.Variable
+',' Operator
+' ' Text
+'5' Name.Variable
+' ' Text
+']' Punctuation
+',' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'[' Punctuation
+' ' Text
+'3' Name.Variable
+',' Operator
+' ' Text
+'3' Name.Variable
+',' Operator
+' ' Text
+'2' Name.Variable
+',' Operator
+' ' Text
+'3' Name.Variable
+',' Operator
+' ' Text
+'3' Name.Variable
+' ' Text
+']' Punctuation
+',' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'[' Punctuation
+' ' Text
+'5' Name.Variable
+',' Operator
+' ' Text
+'5' Name.Variable
+',' Operator
+' ' Text
+'5' Name.Variable
+',' Operator
+' ' Text
+'4' Name.Variable
+',' Operator
+' ' Text
+'4' Name.Variable
+' ' Text
+']' Punctuation
+',' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'[' Punctuation
+' ' Text
+'5' Name.Variable
+',' Operator
+' ' Text
+'1' Name.Variable
+',' Operator
+' ' Text
+'4' Name.Variable
+',' Operator
+' ' Text
+'1' Name.Variable
+',' Operator
+' ' Text
+'1' Name.Variable
+' ' Text
+']' Punctuation
+',' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'[' Punctuation
+' ' Text
+'5' Name.Variable
+',' Operator
+' ' Text
+'3' Name.Variable
+',' Operator
+' ' Text
+'3' Name.Variable
+',' Operator
+' ' Text
+'4' Name.Variable
+',' Operator
+' ' Text
+'5' Name.Variable
+' ' Text
+']' Punctuation
+'\n' Text
+
+'> ' Generic.Prompt
+']' Punctuation
+';' Operator
+';' Operator
+'\n' Text
+
+'gap> ' Generic.Prompt
+'M' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'MagmaByMultiplicationTable' Name.Variable
+'(' Punctuation
+'T' Name.Variable
+')' Punctuation
+';' Operator
+'\n' Text
+
+'<magma with 5 generators>\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'IsAssociative' Name.Variable
+'(' Punctuation
+'M' Name.Variable
+')' Punctuation
+' ' Text
+'or' Operator.Word
+' ' Text
+'IsCommutative' Name.Variable
+'(' Punctuation
+'M' Name.Variable
+')' Punctuation
+';' Operator
+'\n' Text
+
+'false\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'Filtered' Name.Variable
+'(' Punctuation
+'Combinations' Name.Variable
+'(' Punctuation
+'Elements' Name.Variable
+'(' Punctuation
+'M' Name.Variable
+')' Punctuation
+')' Punctuation
+',' Operator
+' ' Text
+'x' Name.Variable
+' ' Text
+'-' Operator
+'>' Operator
+' ' Text
+'Size' Name.Variable
+'(' Punctuation
+'x' Name.Variable
+')' Punctuation
+' ' Text
+'>' Operator
+' ' Text
+'0' Name.Variable
+' ' Text
+'and' Operator.Word
+' ' Text
+'IsAssociative' Name.Variable
+'(' Punctuation
+'x' Name.Variable
+')' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'[ [ m5 ] ]\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'Filtered' Name.Variable
+'(' Punctuation
+'Combinations' Name.Variable
+'(' Punctuation
+'Elements' Name.Variable
+'(' Punctuation
+'M' Name.Variable
+')' Punctuation
+')' Punctuation
+',' Operator
+' ' Text
+'x' Name.Variable
+' ' Text
+'-' Operator
+'>' Operator
+' ' Text
+'Size' Name.Variable
+'(' Punctuation
+'x' Name.Variable
+')' Punctuation
+' ' Text
+'>' Operator
+' ' Text
+'0' Name.Variable
+' ' Text
+'and' Operator.Word
+' ' Text
+'IsCommutative' Name.Variable
+'(' Punctuation
+'x' Name.Variable
+')' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'[ [ m1 ], [ m1, m5 ], [ m2 ], [ m2, m5 ], [ m3 ], [ m3, m4 ], [ m4 ], [ m5 ] ]\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'T' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'[' Punctuation
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'[' Punctuation
+' ' Text
+'1' Name.Variable
+',' Operator
+' ' Text
+'4' Name.Variable
+',' Operator
+' ' Text
+'3' Name.Variable
+',' Operator
+' ' Text
+'3' Name.Variable
+',' Operator
+' ' Text
+'2' Name.Variable
+' ' Text
+']' Punctuation
+',' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'[' Punctuation
+' ' Text
+'4' Name.Variable
+',' Operator
+' ' Text
+'2' Name.Variable
+',' Operator
+' ' Text
+'4' Name.Variable
+',' Operator
+' ' Text
+'4' Name.Variable
+',' Operator
+' ' Text
+'2' Name.Variable
+' ' Text
+']' Punctuation
+',' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'[' Punctuation
+' ' Text
+'3' Name.Variable
+',' Operator
+' ' Text
+'4' Name.Variable
+',' Operator
+' ' Text
+'3' Name.Variable
+',' Operator
+' ' Text
+'4' Name.Variable
+',' Operator
+' ' Text
+'1' Name.Variable
+' ' Text
+']' Punctuation
+',' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'[' Punctuation
+' ' Text
+'1' Name.Variable
+',' Operator
+' ' Text
+'4' Name.Variable
+',' Operator
+' ' Text
+'5' Name.Variable
+',' Operator
+' ' Text
+'4' Name.Variable
+',' Operator
+' ' Text
+'3' Name.Variable
+' ' Text
+']' Punctuation
+',' Operator
+'\n' Text
+
+'> ' Generic.Prompt
+' ' Text
+' ' Text
+'[' Punctuation
+' ' Text
+'2' Name.Variable
+',' Operator
+' ' Text
+'2' Name.Variable
+',' Operator
+' ' Text
+'3' Name.Variable
+',' Operator
+' ' Text
+'5' Name.Variable
+',' Operator
+' ' Text
+'3' Name.Variable
+' ' Text
+']' Punctuation
+'\n' Text
+
+'> ' Generic.Prompt
+']' Punctuation
+';' Operator
+';' Operator
+'\n' Text
+
+'gap> ' Generic.Prompt
+'M' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'MagmaByMultiplicationTable' Name.Variable
+'(' Punctuation
+'T' Name.Variable
+')' Punctuation
+';' Operator
+'\n' Text
+
+'<magma with 5 generators>\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'IsAssociative' Name.Variable
+'(' Punctuation
+'M' Name.Variable
+')' Punctuation
+' ' Text
+'or' Operator.Word
+' ' Text
+'IsCommutative' Name.Variable
+'(' Punctuation
+'M' Name.Variable
+')' Punctuation
+';' Operator
+'\n' Text
+
+'false\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'Filtered' Name.Variable
+'(' Punctuation
+'Combinations' Name.Variable
+'(' Punctuation
+'Elements' Name.Variable
+'(' Punctuation
+'M' Name.Variable
+')' Punctuation
+')' Punctuation
+',' Operator
+' ' Text
+'x' Name.Variable
+' ' Text
+'-' Operator
+'>' Operator
+' ' Text
+'Size' Name.Variable
+'(' Punctuation
+'x' Name.Variable
+')' Punctuation
+' ' Text
+'>' Operator
+' ' Text
+'0' Name.Variable
+' ' Text
+'and' Operator.Word
+' ' Text
+'IsAssociative' Name.Variable
+'(' Punctuation
+'x' Name.Variable
+')' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'[ [ m1 ], [ m1, m3 ], [ m2 ], [ m2, m4 ], [ m3 ], [ m4 ] ]\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'AsSemigroup' Name.Variable
+'(' Punctuation
+'[' Punctuation
+'Elements' Name.Variable
+'(' Punctuation
+'M' Name.Variable
+')' Punctuation
+'[' Punctuation
+'1' Name.Variable
+']' Punctuation
+',' Operator
+' ' Text
+'Elements' Name.Variable
+'(' Punctuation
+'M' Name.Variable
+')' Punctuation
+'[' Punctuation
+'2' Name.Variable
+']' Punctuation
+']' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'fail\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'AsSemigroup' Name.Variable
+'(' Punctuation
+'[' Punctuation
+'Elements' Name.Variable
+'(' Punctuation
+'M' Name.Variable
+')' Punctuation
+'[' Punctuation
+'1' Name.Variable
+']' Punctuation
+',' Operator
+' ' Text
+'Elements' Name.Variable
+'(' Punctuation
+'M' Name.Variable
+')' Punctuation
+'[' Punctuation
+'3' Name.Variable
+']' Punctuation
+']' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'<semigroup of size 2, with 2 generators>\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'Filtered' Name.Variable
+'(' Punctuation
+'Combinations' Name.Variable
+'(' Punctuation
+'Elements' Name.Variable
+'(' Punctuation
+'M' Name.Variable
+')' Punctuation
+')' Punctuation
+',' Operator
+' ' Text
+'x' Name.Variable
+' ' Text
+'-' Operator
+'>' Operator
+' ' Text
+'Size' Name.Variable
+'(' Punctuation
+'x' Name.Variable
+')' Punctuation
+' ' Text
+'>' Operator
+' ' Text
+'0' Name.Variable
+' ' Text
+'and' Operator.Word
+' ' Text
+'IsCommutative' Name.Variable
+'(' Punctuation
+'x' Name.Variable
+')' Punctuation
+')' Punctuation
+';' Operator
+'\n' Text
+
+'[ [ m1 ], [ m1, m2 ], [ m1, m2, m3 ], [ m1, m2, m5 ], [ m1, m3 ], [ m1, m5 ], \n' Generic.Output
+
+' [ m2 ], [ m2, m3 ], [ m2, m4 ], [ m2, m5 ], [ m3 ], [ m4 ], [ m5 ] ]\n' Generic.Output
+
+'\n' Generic.Output
+
+'#\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'F' Name.Variable
+' ' Text
+':=' Operator
+' ' Text
+'Elements' Name.Variable
+'(' Punctuation
+' ' Text
+'GL' Name.Variable
+'(' Punctuation
+'2' Name.Variable
+',' Operator
+'2' Name.Variable
+')' Punctuation
+' ' Text
+')' Punctuation
+';' Operator
+';' Operator
+'\n' Text
+
+'gap> ' Generic.Prompt
+'IsAssociative' Name.Variable
+'(' Punctuation
+' ' Text
+'F' Name.Variable
+' ' Text
+')' Punctuation
+';' Operator
+'\n' Text
+
+'true\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'IsCommutative' Name.Variable
+'(' Punctuation
+' ' Text
+'F' Name.Variable
+' ' Text
+')' Punctuation
+';' Operator
+'\n' Text
+
+'false\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'Number' Name.Variable
+'(' Punctuation
+' ' Text
+'Combinations' Name.Variable
+'(' Punctuation
+' ' Text
+'F' Name.Variable
+',' Operator
+' ' Text
+'3' Name.Variable
+' ' Text
+')' Punctuation
+',' Operator
+' ' Text
+'IsCommutative' Name.Variable
+' ' Text
+')' Punctuation
+';' Operator
+'\n' Text
+
+'1\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'AsSemigroup' Name.Variable
+'(' Punctuation
+' ' Text
+'F' Name.Variable
+' ' Text
+')' Punctuation
+';' Operator
+'\n' Text
+
+'<semigroup of size 6, with 2 generators>\n' Generic.Output
+
+'\n' Generic.Output
+
+'#\n' Generic.Output
+
+'gap> ' Generic.Prompt
+'STOP_TEST' Name.Variable
+'(' Punctuation
+' ' Text
+'"magma.tst"' Literal.String
+' ' Text
+')' Punctuation
+';' Operator
+'\n' Text
diff --git a/tests/examplefiles/scilab/bench_chol.tst b/tests/examplefiles/scilab/bench_chol.tst
new file mode 100644
index 00000000..d03eea05
--- /dev/null
+++ b/tests/examplefiles/scilab/bench_chol.tst
@@ -0,0 +1,23 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2007-2008 - INRIA
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+//==============================================================================
+// Benchmark for chol function
+//==============================================================================
+
+// <-- BENCH NB RUN : 10 -->
+
+stacksize(30000000);
+
+a = 0;
+b = 0;
+a = rand(900, 900, 'n');
+a = a'*a;
+
+// <-- BENCH START -->
+b = chol(a);
+// <-- BENCH END -->
diff --git a/tests/examplefiles/scilab/bench_chol.tst.output b/tests/examplefiles/scilab/bench_chol.tst.output
new file mode 100644
index 00000000..a63bfe51
--- /dev/null
+++ b/tests/examplefiles/scilab/bench_chol.tst.output
@@ -0,0 +1,95 @@
+'// =============================================================================' Comment.Single
+'\n' Text.Whitespace
+
+'// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab' Comment.Single
+'\n' Text.Whitespace
+
+'// Copyright (C) 2007-2008 - INRIA' Comment.Single
+'\n' Text.Whitespace
+
+'//' Comment.Single
+'\n' Text.Whitespace
+
+'// This file is distributed under the same license as the Scilab package.' Comment.Single
+'\n' Text.Whitespace
+
+'// =============================================================================' Comment.Single
+'\n\n' Text.Whitespace
+
+'//==============================================================================' Comment.Single
+'\n' Text.Whitespace
+
+'// Benchmark for chol function' Comment.Single
+'\n' Text.Whitespace
+
+'//==============================================================================' Comment.Single
+'\n\n' Text.Whitespace
+
+'// <-- BENCH NB RUN : 10 -->' Comment.Single
+'\n\n' Text.Whitespace
+
+'stacksize' Name.Builtin
+'(' Punctuation
+'30000000' Literal.Number.Integer
+');' Punctuation
+'\n\n' Text.Whitespace
+
+'a' Name
+' ' Text.Whitespace
+'=' Punctuation
+' ' Text.Whitespace
+'0' Literal.Number.Integer
+';' Punctuation
+'\n' Text.Whitespace
+
+'b' Name
+' ' Text.Whitespace
+'=' Punctuation
+' ' Text.Whitespace
+'0' Literal.Number.Integer
+';' Punctuation
+'\n' Text.Whitespace
+
+'a' Name
+' ' Text.Whitespace
+'=' Punctuation
+' ' Text.Whitespace
+'rand' Name.Builtin
+'(' Punctuation
+'900' Literal.Number.Integer
+',' Punctuation
+' ' Text.Whitespace
+'900' Literal.Number.Integer
+',' Punctuation
+' ' Text.Whitespace
+"'" Literal.String
+"n'" Literal.String
+');' Punctuation
+'\n' Text.Whitespace
+
+'a' Name
+' ' Text.Whitespace
+'=' Punctuation
+' ' Text.Whitespace
+'a' Name
+"'" Operator
+'*' Operator
+'a' Name
+';' Punctuation
+'\n\n' Text.Whitespace
+
+'// <-- BENCH START -->' Comment.Single
+'\n' Text.Whitespace
+
+'b' Name
+' ' Text.Whitespace
+'=' Punctuation
+' ' Text.Whitespace
+'chol' Name.Builtin
+'(' Punctuation
+'a' Name
+');' Punctuation
+'\n' Text.Whitespace
+
+'// <-- BENCH END -->' Comment.Single
+'\n' Text.Whitespace