Skip to content

Commit

Permalink
Add tests for invalid inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanPfersdorff committed Nov 6, 2021
1 parent 6698815 commit 9f4c917
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gap/SubfieldMatrixGroups.gi
Original file line number Diff line number Diff line change
Expand Up @@ -285,17 +285,17 @@ function (d, p, e, f)
local F, q0, b, gens, l, zeta, omega, zetaPower, C, gen;

if IsOddInt(d) then
ErrorNoReturn("Dimension <d> must be even.");
ErrorNoReturn("<d> must be even.");
fi;

if e mod f <> 0 then
ErrorNoReturn("<f> must be a divisor of <e>");
ErrorNoReturn("<f> must be a divisor of <e>.");
fi;

b := QuoInt(e, f);

if not IsPrime(b) then
ErrorNoReturn("The quotient of <f> by <e> must be a prime");
ErrorNoReturn("the quotient of <f> by <e> must be a prime.");
fi;

F := GF(p ^ e);
Expand Down
6 changes: 6 additions & 0 deletions tst/standard/SubfieldMatrixGroups.tst
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,9 @@ gap> TestSubfieldSp := function(args)
gap> testsSubfieldSp := [[6, 2, 2, 1], [4, 3, 2, 1], [4, 3, 4, 2], [4, 7, 2, 1]];;
gap> ForAll(testsSubfieldSp, TestSubfieldSp);
true
gap> SubfieldSp(3, 2, 2, 1);
Error, <d> must be even.
gap> SubfieldSp(4, 2, 1, 2);
Error, <f> must be a divisor of <e>.
gap> SubfieldSp(4, 2, 4, 1);
Error, the quotient of <f> by <e> must be a prime.

0 comments on commit 9f4c917

Please sign in to comment.