|
| 1 | +#@local prg, data |
| 2 | +############################################################################ |
| 3 | +## |
| 4 | +#W gslp.tst Utils Package Thomas Breuer |
| 5 | +## |
| 6 | +#Y Copyright (C) 2026, The GAP Group |
| 7 | +## |
| 8 | +gap> START_TEST( "gslp.tst" ); |
| 9 | + |
| 10 | +# |
| 11 | +gap> ReadPackage( "utils", "tst/loadall.g" );; |
| 12 | +gap> UtilsLoadingComplete; |
| 13 | +true |
| 14 | + |
| 15 | +# test inconsistent input for `GeneralizedStraightLineProgram` |
| 16 | +gap> GeneralizedStraightLineProgram( "union", [[[1,2]]], 1 ); |
| 17 | +Error, usage: GeneralizedStraightLineProgram( <lines>[, <nrgens>] ) or General\ |
| 18 | +izedStraightLineProgram( <kind>, <list> ) |
| 19 | +gap> GeneralizedStraightLineProgram( "union", [] ); |
| 20 | +Error, <list> must be a nonempty list |
| 21 | +gap> GeneralizedStraightLineProgram( "union", |
| 22 | +> [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 2 ] ] ); |
| 23 | +Error, all entries of <list> must have the same input number |
| 24 | +gap> GeneralizedStraightLineProgram( "compose", |
| 25 | +> [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 2 ] ] ); |
| 26 | +Error, inputs and outputs for <list> are not compatible |
| 27 | +gap> GeneralizedStraightLineProgram( "other", [[[1,2]]] ); |
| 28 | +Error, <kind> must be one of "union", "compose" |
| 29 | + |
| 30 | +# test cases of `NrOutputsOfGeneralizedStraightLineProgram` |
| 31 | +gap> prg:= StraightLineProgram( [ [1,2,2,3], [3,-1] ], 2 );; |
| 32 | +gap> NrOutputsOfGeneralizedStraightLineProgram( prg ); |
| 33 | +1 |
| 34 | + |
| 35 | +# test `false` cases of `IsInternallyConsistent` |
| 36 | +gap> prg:= GeneralizedStraightLineProgram( "compose", |
| 37 | +> [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );; |
| 38 | +gap> ResetFilterObj( prg, HasNrInputsOfGeneralizedStraightLineProgram ); |
| 39 | +gap> SetNrInputsOfGeneralizedStraightLineProgram( prg, 3 ); |
| 40 | +gap> IsInternallyConsistent( prg ); |
| 41 | +false |
| 42 | +gap> data:= ShallowCopy( DataOfGeneralizedStraightLineProgram( prg ) );; |
| 43 | +gap> data[1]:= "other";; |
| 44 | +gap> ResetFilterObj( prg, HasDataOfGeneralizedStraightLineProgram ); |
| 45 | +gap> SetDataOfGeneralizedStraightLineProgram( prg, data ); |
| 46 | +gap> IsInternallyConsistent( prg ); |
| 47 | +false |
| 48 | + |
| 49 | +# `ViewString` and `String` |
| 50 | +gap> ViewString( StraightLineProgram( [[[1,2]]], 1 ) ); |
| 51 | +"<straight line program>" |
| 52 | +gap> ViewString( GeneralizedStraightLineProgram( "union", [ [[[1,2]]] ] ) ); |
| 53 | +"<generalized straight line program>" |
| 54 | +gap> String( StraightLineProgram( [[[1,2]]], 1 ) ); |
| 55 | +"StraightLineProgram( [ [ [ 1, 2 ] ] ], 1 )" |
| 56 | +gap> String( GeneralizedStraightLineProgram( "union", [ [[[1,2]]] ] ) ); |
| 57 | +"GeneralizedStraightLineProgram( \"union\", [ StraightLineProgram( [ [ 1, 2 ] \ |
| 58 | +], 1 ) ] )" |
| 59 | + |
| 60 | +# |
| 61 | +gap> STOP_TEST( "gslp.tst" ); |
0 commit comments