Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  extractmanuals.g   Sprache: unbekannt

 
#############################################################################
##
##  This file is part of GAP, a system for computational discrete algebra.
##
##  Copyright of GAP belongs to its developers, whose names are too numerous
##  to list here. Please refer to the COPYRIGHT file for details.
##
##  SPDX-License-Identifier: GPL-2.0-or-later
##

# This code extracts the examples from manuals chapter-wise and
# stores them in a file that can be passed to the Test function

WriteExamplesTst := function(directory, meta)
    local examples, ch, chname, chapterfiles, i, a, output;
    examples := ExtractExamples(meta.pathtodoc, meta.main,
                                meta.files, "Chapter" );
    chapterfiles := [];
    directory := Directory(directory);
    for i in [1..Length(examples)] do
        ch := examples[i];
        if Length(ch) > 0 then
            chname := STRINGIFY(meta.bookname, "-chapter", String(1000+i){[2..4]}, ".tst");
            Add(chapterfiles, chname);

            # Note that the following truncates the testfile.
            output := OutputTextFile( Filename(directory, chname), false );
            SetPrintFormattingStatus( output, false );

            AppendTo(output, "####  Reference manual, Chapter ",i,"  ####\n",
                     "gap> START_TEST(\"", chname, "\");\n");
            for a in ch do
                AppendTo(output, "\n#LOC# ", a[2], a[1]);
                if Last(a[1]) <> '\n' then
                   AppendTo(output, "\n");
                fi;
            od;
            AppendTo(output, "\n\n\ngap> STOP_TEST(\"", chname, "\");");
        fi;
    od;
    return chapterfiles;
end;

testdir := Filename(DirectoriesLibrary("tst")[1], "testmanuals");
CreateDir(testdir);

#
# reference manual
#
Print("Extracting reference manual examples to ", testdir, "...\n");
pathtodoc := DirectoriesLibrary("doc/ref");
Read(Filename(pathtodoc, "makedocreldata.g"));
GAPInfo.ManualDataRef.pathtodoc := pathtodoc;
GAPInfo.ManualDataRef.pathtoroot := DirectoriesLibrary("");
UpdateXMLForUserPreferences();
WriteExamplesTst( testdir, GAPInfo.ManualDataRef );

#
# tutorial
#
Print("Extracting tutorial examples to ", testdir, "...\n");
pathtodoc := DirectoriesLibrary("doc/tut");
Read(Filename(pathtodoc, "makedocreldata.g"));
GAPInfo.ManualDataTut.pathtodoc := pathtodoc;
GAPInfo.ManualDataTut.pathtoroot := DirectoriesLibrary("");
WriteExamplesTst( testdir, GAPInfo.ManualDataTut );

#
QuitGap(0);

[ Dauer der Verarbeitung: 0.6 Sekunden  (vorverarbeitet)  ]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge