Skip to content

Commit

Permalink
adding tests for HashMapRelations
Browse files Browse the repository at this point in the history
  • Loading branch information
egri-nagy committed Jun 14, 2024
1 parent d3b5f90 commit 5ff3bcf
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 44 deletions.
2 changes: 1 addition & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
upcoming
Covering Lemma implementation
Covering Lemma implementation: adding HashMapRelations,
0.9.8
Better constructors for Cascades needed by the upcoming Covering Lemma implementation.
Cascades now have a partially implemented List interface. This was needed to be able use them in HashMaps. BREAKING CHANGE: as a consequence, the ^ operation is not registered any more for OnCoordinates.
Expand Down
19 changes: 19 additions & 0 deletions tst/hashmaprel.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
gap> START_TEST("Relations represented by HashMaps");
gap> LoadPackage("sgpdec", false);;
gap> hmr := HashMap([[1,[2,3]],[2,[3]]]);
HashMap([[ 1, [ 2, 3 ] ], [ 2, [ 3 ] ]])
gap> ImageOfHashMapRelation(hmr);
[ 2, 3 ]
gap> IsInjectiveHashMapRelation(hmr);
false
gap> IsInjectiveHashMapRelation2(hmr);
false
gap> hmr := HashMap([[1,[2,3]],[2,[4,5,6]]]);
HashMap([[ 1, [ 2, 3 ] ], [ 2, [ 4, 5, 6 ] ]])
gap> IsInjectiveHashMapRelation2(hmr);
true
gap> IsInjectiveHashMapRelation(hmr);
true
gap> InvertHashMapRelation(hmr);
HashMap([[ 2, [ 1 ] ], [ 3, [ 1 ] ], [ 4, [ 2 ] ], [ 5, [ 2 ] ], [ 6, [ 2 ] ]])
gap> STOP_TEST( "Relations represented by HashMaps");
28 changes: 5 additions & 23 deletions tst/testall.g
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
LoadPackage( "sgpdec" );
LoadPackage( "sgpdec", false);

# `TestDirectory` provides a convenient way to run collections of tests.
# It also simplifies adding new tests, because it automatically picks
# up all files having extension `.tst`
#
# It also ensures that it will display an information message that is
# needed to detect whether a test passed or failed in a number of automated
# settings.
#
# If you need to run some other tests in addition to `TestDirectory`,
# you code should analyse the outcome of the test, and then
# print an information using the string that looks exactly as shown below:
#
# if testresult
# Print("#I No errors detected while testing"\n");
# else
# Print("#I Errors detected while testing\n");
# fi;
#
#
TestDirectory(DirectoriesPackageLibrary( "sgpdec", "tst" ),
rec(exitGAP := true,
testOptions := rec(compareFunction := "uptowhitespace", transformFunction := "removenl") ) );
TestDirectory(DirectoriesPackageLibrary("sgpdec","tst"),
rec(exitGAP := true,
testOptions := rec(compareFunction := "uptowhitespace",
transformFunction := "removenl") ) );

FORCE_QUIT_GAP(1); # if we ever get here, there was an error
41 changes: 21 additions & 20 deletions tst/testfunctions.g
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
SgpDecTestInstall := function()
local test;
for test in [
"lowerbound",
"disjointuniongroup",
"WeakControlWords",
"wreath",
"cascade",
"depfunc",
"fl",
"skeleton",
"holonomy",
"cartesianenum",
"transnot",
"viz",
"straightword",
"manual"
] do
Test(Concatenation(
PackageInfo("sgpdec")[1]!.InstallationPath,
"/tst/",test,
".tst"));;
for test in
["hashmaprel",
"lowerbound",
"disjointuniongroup",
"WeakControlWords",
"wreath",
"cascade",
"depfunc",
"fl",
"skeleton",
"holonomy",
"cartesianenum",
"transnot",
"viz",
"straightword",
"manual"
] do
Test(Concatenation(PackageInfo("sgpdec")[1]!.InstallationPath,
"/tst/",test,
".tst"),
rec(compareFunction := "uptowhitespace"));;
od;
end;
MakeReadOnlyGlobal("SgpDecTestInstall");

0 comments on commit 5ff3bcf

Please sign in to comment.