File: runexamples.g

package info (click to toggle)
gap 4r8p6-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 33,476 kB
  • ctags: 7,663
  • sloc: ansic: 108,841; xml: 47,807; sh: 3,628; perl: 2,342; makefile: 796; asm: 62; awk: 6
file content (34 lines) | stat: -rw-r--r-- 1,250 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# This runs the examples from the ref manual chapter-wise and indicates
# differences in files EXAMPLEDIFFSnr where nr is the number of the chapter.

SaveWorkspace("wsp");

for i in [1..Length(exsref)] do
  Print("Checking ref, Chapter ",i,"\n");
  resfile := Concatenation( "EXAMPLEDIFFS", 
                            ListWithIdenticalEntries(2-Length(String(i)),'0'), 
                            String(i) );
  RemoveFile(resfile);
  Exec(Concatenation("echo 'RunExamples(exsref{[", String(i), 
       "]}",
  # By default compare up to whitespace, so some editing wrt. line breaks
  # or other whitespace in example output is accepted.
  # Comment the "WS" for comparison with \=.
  # Uncomment the "WSRS" or "RS" to change the source code to the 
  # current output.
       ", WS",
##         ", RS",
##         ", WSRS",
       ");' | ../../bin/gap.sh -b -r -A -q -L wsp > ", resfile ));
  str := StringFile(resfile);
  if str{[Length(str)-22..Length(str)]} = "# Running list 1 . . .\n" then
    RemoveFile(resfile);
  else
    pos := PositionSublist(str, "# Running list 1 . . .\n");
    FileString(resfile, str{[pos+23..Length(str)]});
    Print("    found differences in ref, see file ", resfile, "\n");
  fi;
od;
RemoveFile("wsp");
QUIT;