File: runexamples.g

package info (click to toggle)
gap 4.15.1-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 110,212 kB
  • sloc: ansic: 97,261; xml: 48,343; cpp: 13,946; sh: 4,900; perl: 1,650; javascript: 255; makefile: 252; ruby: 9
file content (34 lines) | stat: -rw-r--r-- 1,239 bytes parent folder | download | duplicates (2)
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",
       ");' | ../../gap -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;