From d0f3eaa4131cb9e04a214b16fdddbf35007102ba Mon Sep 17 00:00:00 2001 From: Wilf Wilson Date: Tue, 12 Sep 2017 19:03:36 +0100 Subject: [PATCH] gprd.gi: fix assertion in PrimePGroup Resolves #1719 --- lib/gprd.gi | 11 ++++++----- tst/testbugfix/2017-09-13-PrimePGroup.tst | 11 +++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 tst/testbugfix/2017-09-13-PrimePGroup.tst diff --git a/lib/gprd.gi b/lib/gprd.gi index 698cdd2d90..fd5bd46f2d 100644 --- a/lib/gprd.gi +++ b/lib/gprd.gi @@ -263,11 +263,12 @@ end ); InstallMethod( PrimePGroup, "for direct products", [IsPGroup and HasDirectProductInfo], function( D ) - local p; - Assert (1, ForAll (DirectProductInfo( D ).groups, IsPGroup)); - p := First (DirectProductInfo( D ).groups, G -> PrimePGroup (G) <> fail); - Assert (1, ForAll (DirectProductInfo( D ).groups, G -> PrimePGroup (G) in [fail, p])); - return PrimePGroup(p); + local groups, p; + groups := DirectProductInfo(D).groups; + Assert(1, ForAll(groups, IsPGroup)); + p := PrimePGroup(First(groups, G -> PrimePGroup(G) <> fail)); + Assert(1, ForAll(groups, G -> PrimePGroup(G) in [fail, p])); + return p; end ); ############################################################################# diff --git a/tst/testbugfix/2017-09-13-PrimePGroup.tst b/tst/testbugfix/2017-09-13-PrimePGroup.tst new file mode 100644 index 0000000000..aa1a281627 --- /dev/null +++ b/tst/testbugfix/2017-09-13-PrimePGroup.tst @@ -0,0 +1,11 @@ +# Issue related to PrimePGroup for filter IsPGroup and HasDirectProductInfo +# Examples reported on issue #1719 on github.com/gap-system/gap +# +gap> level := AssertionLevel();; +gap> SetAssertionLevel(1); +gap> G := CyclicGroup(IsPcGroup, 5);; +gap> H := Range(IsomorphismPermGroup(G)); +Group([ (1,2,3,4,5) ]) +gap> PrimePGroup(H); +5 +gap> SetAssertionLevel(level);;