Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/tst/testinstall/opers/   (Algebra von RWTH Aachen Version 4.15.1©)  Datei vom 18.9.2025 mit Größe 1017 B image not shown  

Quelle  LocationFunc.tst   Sprache: unbekannt

 
gap> START_TEST("LocationFunc.tst");

#
gap> LocationFunc(fail);
Error, <func> must be a function

# regular GAP function
gap> f:=x->x;;
gap> LocationFunc(f);
"stream:1"

# Library function
gap> PositionSublist(LocationFunc(Where),"/lib/error.g:") <> fail;
true

# GAP function which was compiled to C code by gac
# this yields something like "GAPROOT/lib/oper1.g:147"
# but we don't want to depend on the changing line numbers,
# so we invest some extra work to test the format without
# relying on the specific content
gap> loc:=LocationFunc(INSTALL_METHOD_FLAGS);;
gap> StartsWith(loc, "GAPROOT/lib/oper1.g:");
true
gap> ForAll(loc{[21..Length(loc)]}, IsDigitChar);
true

# proper kernel function
gap> LocationFunc(APPEND_LIST_INTR);
"src/listfunc.c:APPEND_LIST_INTR"

# String is an attribute, so no information is stored
gap> LocationFunc( String );
fail

# functions created from a syntax tree have no location
gap> LocationFunc(SYNTAX_TREE_CODE(SYNTAX_TREE(x->x)));
fail

#
gap> STOP_TEST("LocationFunc.tst");

[ Dauer der Verarbeitung: 0.17 Sekunden  (vorverarbeitet)  ]