From a698f21421fa5df2b111b76cd60dd22f6272183c Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 10 Jan 2024 02:42:58 +0100 Subject: [PATCH] Cleanup in `tst` (#5571) * Rename tst/testutil.g -> tst/delegation.g Also remove an outdated (now incorrect) comment referencing that file; and remove an old bugfix test accessing it: it is not clear what that bugfix was supposed to test: it used to invoke just `ReadGapRoot` but was rewritten to call `IsReadableFile`+`Filename`+`DirectoriesLibrary`; but it is not clear what either is supposed to test, exactly. * tst: move two files into tst/testinstall/ Those files are only used by `testinstall` so it makes sense to move them in there. But primarily, it gets us closer to having all files with a name of the form `tst/test*.g` serving the same purpose, namely to run a testsuite with corresponding name. * tst: unify some permutation constructor tests Properly test bounds checks in the kernel for creating permutations: one of the errors can only ever be reached in 64 bit mode; the other however can always be reached, and thus should always be tested. Note that the tst/test32bit and tst/test64bit directories were supposed to be removed in 2018 (!) and files in there were in fact not loaded since then (!!). My guess is that a file in each remained because of PRs being merged "out of order" so that the PR which was supposed to remove those dirs was merged only after some other PR added new files. But we actually tested the constructors as part of the `RestrictedPerm` tests, but it really wasn't appropriate there (the tests didn't even reach `RestrictedPerm` as the kernel errors occur before the call). --- lib/profile.g | 3 --- tst/{testutil.g => delegation.g} | 3 --- tst/test32bit/perm.tst | 5 ----- tst/test64bit/perm.tst | 4 ---- tst/testbugfix/2005-05-05-t00072.tst | 3 --- tst/testinstall/coll.tst | 2 +- tst/testinstall/perm.tst | 7 +++++++ tst/testinstall/random.tst | 2 +- tst/testinstall/restrictedperm.tst | 8 -------- tst/{ => testinstall}/testenumerator.g | 0 tst/{ => testinstall}/testrandom.g | 0 11 files changed, 9 insertions(+), 28 deletions(-) rename tst/{testutil.g => delegation.g} (96%) delete mode 100644 tst/test32bit/perm.tst delete mode 100644 tst/test64bit/perm.tst delete mode 100644 tst/testbugfix/2005-05-05-t00072.tst rename tst/{ => testinstall}/testenumerator.g (100%) rename tst/{ => testinstall}/testrandom.g (100%) diff --git a/lib/profile.g b/lib/profile.g index 6972bc0e3f..ca7d399c09 100644 --- a/lib/profile.g +++ b/lib/profile.g @@ -1068,9 +1068,6 @@ end); ## STOP_TEST( "same identifier string as for START_TEST" ); ## ]]> -##

-## Note that the functions in tst/testutil.g temporarily replace -## before they call . ## ## ## <#/GAPDoc> diff --git a/tst/testutil.g b/tst/delegation.g similarity index 96% rename from tst/testutil.g rename to tst/delegation.g index 2c96fd24bf..e8dee4758c 100644 --- a/tst/testutil.g +++ b/tst/delegation.g @@ -7,9 +7,6 @@ ## ## SPDX-License-Identifier: GPL-2.0-or-later ## -## This file contains utilities for running tests. -## It is not read with the library when {\GAP} is started. -## ############################################################################# diff --git a/tst/test32bit/perm.tst b/tst/test32bit/perm.tst deleted file mode 100644 index bc7c74d8e1..0000000000 --- a/tst/test32bit/perm.tst +++ /dev/null @@ -1,5 +0,0 @@ -# -gap> f:={a,b} -> (a,b);; -gap> f(2,2^40); -Error, Permutation: must be a positive small integer (not a large posit\ -ive integer) diff --git a/tst/test64bit/perm.tst b/tst/test64bit/perm.tst deleted file mode 100644 index 2f05bc07f2..0000000000 --- a/tst/test64bit/perm.tst +++ /dev/null @@ -1,4 +0,0 @@ -# -gap> f:={a,b} -> (a,b);; -gap> f(2,2^40); -Error, Permutation literal exceeds maximum permutation degree diff --git a/tst/testbugfix/2005-05-05-t00072.tst b/tst/testbugfix/2005-05-05-t00072.tst deleted file mode 100644 index f54159e435..0000000000 --- a/tst/testbugfix/2005-05-05-t00072.tst +++ /dev/null @@ -1,3 +0,0 @@ -# 2005/05/05 (TB) -gap> IsReadableFile( Filename( DirectoriesLibrary( "tst" ), "testutil.g" ) ); -true diff --git a/tst/testinstall/coll.tst b/tst/testinstall/coll.tst index cdb2c3c87d..823517b148 100644 --- a/tst/testinstall/coll.tst +++ b/tst/testinstall/coll.tst @@ -4,7 +4,7 @@ ## gap> START_TEST("coll.tst"); gap> if not IsBound(TestConsistencyOfEnumeratorByFunctions) then -> ReadGapRoot( "tst/testenumerator.g" ); +> ReadGapRoot( "tst/testinstall/testenumerator.g" ); > fi; # diff --git a/tst/testinstall/perm.tst b/tst/testinstall/perm.tst index 5431cc4a00..295af000f6 100644 --- a/tst/testinstall/perm.tst +++ b/tst/testinstall/perm.tst @@ -26,6 +26,13 @@ gap> (1,2)(1,2); Error, Permutation: cycles must be disjoint and duplicate-free gap> (1,2,3,2); Error, Permutation: cycles must be disjoint and duplicate-free +gap> (1,2^80); +Error, Permutation: must be a positive small integer (not a large posit\ +ive integer) +#@if 8*GAPInfo.BytesPerVariable = 64 +gap> (1,2^40); +Error, Permutation literal exceeds maximum permutation degree +#@fi # The GAP kernel implements many functions in multiple variants, e.g. to # compare permutations for equality, there are actually four functions in the diff --git a/tst/testinstall/random.tst b/tst/testinstall/random.tst index eb30567a33..a3a5bd2a3e 100644 --- a/tst/testinstall/random.tst +++ b/tst/testinstall/random.tst @@ -1,6 +1,6 @@ #@local R,a,rm,g,orbs,orb,i,getOneInt gap> START_TEST("random.tst"); -gap> ReadGapRoot( "tst/testrandom.g" ); +gap> ReadGapRoot( "tst/testinstall/testrandom.g" ); # Test RandomList gap> randomTest([1,2,3], RandomList); diff --git a/tst/testinstall/restrictedperm.tst b/tst/testinstall/restrictedperm.tst index fc988f34ce..45a5cc1716 100644 --- a/tst/testinstall/restrictedperm.tst +++ b/tst/testinstall/restrictedperm.tst @@ -11,14 +11,6 @@ Error, must be a permutation and a plain list or range, gap> RestrictedPerm((),[ 1, 0 ]); Error, must be a permutation and a plain list or range, consisting of a union of cycles of -#@if 8*GAPInfo.BytesPerVariable = 64 -gap> RestrictedPerm((1,2^40),[ 1, () ]); -Error, Permutation literal exceeds maximum permutation degree -#@else -gap> RestrictedPerm((1,2^40),[ 1, () ]); -Error, Permutation: must be a positive small integer (not a large posit\ -ive integer) -#@fi gap> RestrictedPerm((1,2^17),[ 1, () ]); Error, must be a permutation and a plain list or range, consisting of a union of cycles of diff --git a/tst/testenumerator.g b/tst/testinstall/testenumerator.g similarity index 100% rename from tst/testenumerator.g rename to tst/testinstall/testenumerator.g diff --git a/tst/testrandom.g b/tst/testinstall/testrandom.g similarity index 100% rename from tst/testrandom.g rename to tst/testinstall/testrandom.g