Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Pfeiffer committed Aug 17, 2018
1 parent c7173a2 commit 01275c9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 45 deletions.
31 changes: 10 additions & 21 deletions tst/testlibgap/basic.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ void test_eval(const char * cmd)
Obj res, ires;
Int rc, i;

printf("Input:\n%s", cmd);
printf("gap> %s\n", cmd);
res = GAP_EvalString(cmd);
rc = GAP_LenPList(res);
for(i=1;i<=rc;i++) {
ires = GAP_ElmPList(res, i);
if( GAP_ElmPList(ires, 1) == True )
printf("Output:\n%s\n", CSTR_STRING(GAP_ElmPList(ires, 5)));
printf("%s\n", CSTR_STRING(GAP_ElmPList(ires, 5)));
}
}

Expand All @@ -32,26 +32,15 @@ int main(int argc, char **argv)

CollectBags(0, 1); // full GC

test_eval("1+2+3;\n");
test_eval("g:=FreeGroup(2);\n");
test_eval("a:=g.1;\n");
test_eval("b:=g.2;\n");
test_eval("lis:=[a^2, a^2, b*a];\n");
test_eval("h:=g/lis;\n");
test_eval("c:=h.1;\n");
test_eval("Set([1..1000000], i->Order(c));\n");
test_eval("1+2+3;");
test_eval("g:=FreeGroup(2);");
test_eval("a:=g.1;");
test_eval("b:=g.2;");
test_eval("lis:=[a^2, a^2, b*a];");
test_eval("h:=g/lis;");
test_eval("c:=h.1;");
test_eval("Set([1..1000000], i->Order(c));");

GAP_Finalize();
return 0;
}


/*
g:=FreeGroup(2);
a:=g.1;
b:=g.2;
lis:=[a^2, a^2, b*a];
h:=g/lis;
c:=h.1;
Set([1..300000], i->Order(c));
*/
32 changes: 8 additions & 24 deletions tst/testlibgap/basic.expect
Original file line number Diff line number Diff line change
@@ -1,34 +1,18 @@
Initializing GAP...
done
Input:
1+2+3;
Output:
gap> 1+2+3;
6
Input:
g:=FreeGroup(2);
Output:
gap> g:=FreeGroup(2);
<free group on the generators [ f1, f2 ]>
Input:
a:=g.1;
Output:
gap> a:=g.1;
f1
Input:
b:=g.2;
Output:
gap> b:=g.2;
f2
Input:
lis:=[a^2, a^2, b*a];
Output:
gap> lis:=[a^2, a^2, b*a];
[ f1^2, f1^2, f2*f1 ]
Input:
h:=g/lis;
Output:
gap> h:=g/lis;
<fp group on the generators [ f1, f2 ]>
Input:
c:=h.1;
Output:
gap> c:=h.1;
f1
Input:
Set([1..1000000], i->Order(c));
Output:
gap> Set([1..1000000], i->Order(c));
[ 2 ]
Expand Down

0 comments on commit 01275c9

Please sign in to comment.