Skip to content

Commit b4feb62

Browse files
committed
Adding test coverage for new error catching
1 parent 69fe761 commit b4feb62

2 files changed

Lines changed: 43 additions & 10 deletions

File tree

gap/io.gi

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,12 +2223,21 @@ InstallMethod(Graph6String, "for a digraph by out-neighbours",
22232223
function(D)
22242224
local list, adj, n, lenlist, tablen, blist, i, j, pos, block;
22252225
if IsMultiDigraph(D) then
2226-
ErrorNoReturn("the argument <D> must not have multiple edges; consider encoding in Disparse6 or Digraph6");
2227-
elif not IsSymmetricDigraph(D) then
2228-
ErrorNoReturn("the argument <D> must be a symmetric digraph; consider encoding in Sparse6 or Disparse6");
2229-
elif DigraphHasLoops(D) then
2230-
ErrorNoReturn("the argument <D> must not have loops; consider encoding in Sparse6 or Disparse6");
2231-
fi;
2226+
ErrorNoReturn(
2227+
"the argument <D> must not have multiple edges; ",
2228+
"consider encoding in Disparse6 or Digraph6"
2229+
);
2230+
elif not IsSymmetricDigraph(D) then
2231+
ErrorNoReturn(
2232+
"the argument <D> must be a symmetric digraph; ",
2233+
"consider encoding in Sparse6 or Disparse6"
2234+
);
2235+
elif DigraphHasLoops(D) then
2236+
ErrorNoReturn(
2237+
"the argument <D> must not have loops; ",
2238+
"consider encoding in Sparse6 or Disparse6"
2239+
);
2240+
fi;
22322241

22332242
list := [];
22342243
adj := OutNeighbours(D);
@@ -2351,9 +2360,15 @@ function(D)
23512360

23522361
if not IsSymmetricDigraph(D) then
23532362
if IsMultiDigraph(D) then
2354-
ErrorNoReturn("the argument <D> must be a symmetric digraph consider encoding in Disparse6,");
2363+
ErrorNoReturn(
2364+
"the argument <D> must be a symmetric digraph; ",
2365+
"consider encoding in Disparse6"
2366+
);
23552367
else
2356-
ErrorNoReturn("the argument <D> must be a symmetric digraph consider encoding in Digraph6 or Disparse6,");
2368+
ErrorNoReturn(
2369+
"the argument <D> must be a symmetric digraph; ",
2370+
"consider encoding in Digraph6 or Disparse6"
2371+
);
23572372
fi;
23582373
fi;
23592374

tst/standard/io.tst

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,8 @@ Error, the 2nd argument <s> is not a valid disparse6 string,
546546

547547
# Special format characters
548548
gap> Sparse6String(ChainDigraph(3));
549-
Error, the argument <D> must be a symmetric digraph consider encoding in Digra\
550-
ph6 or Disparse6,
549+
Error, the argument <D> must be a symmetric digraph; consider encoding in Digr\
550+
aph6 or Disparse6
551551
gap> Sparse6String(CompleteDigraph(1));
552552
":@"
553553
gap> gr := Digraph([[1], []]);;
@@ -560,6 +560,24 @@ gap> DigraphFromSparse6String(":TdBkJ`Kq?x");
560560
gap> Sparse6String(last);
561561
":TdBkJ`Kq?"
562562

563+
# Multiple Edges Digraph6
564+
gap> gr := Digraph([[1,1], [2]]);;
565+
gap> Digraph6String(gr);
566+
Error, the argument <D> must not have multiple edges consider encoding in Spar\
567+
se6 or Disparse6,
568+
569+
# Non-symmetric Digraph in Sparse6
570+
gap> gr := Digraph([[2], []]);;
571+
gap> Sparse6String(gr);
572+
Error, the argument <D> must be a symmetric digraph; consider encoding in Digr\
573+
aph6 or Disparse6
574+
575+
# Digraph with loops in Sparse6
576+
gap> gr := Digraph([[1], [2]]);;
577+
gap> Graph6String(gr);
578+
Error, the argument <D> must not have loops; consider encoding in Sparse6 or D\
579+
isparse6
580+
563581
# DigraphPlainTextLineDecoder: bad input
564582
gap> DigraphPlainTextLineDecoder(" ", " ", 1, ".");
565583
Error, no method found! For debugging hints type ?Recovery from NoMethodFound

0 commit comments

Comments
 (0)