DOC: add application/test/README.md

- extraction of Description from the respective tests.
  Relatively incomplete

  Uses the `application/tests/get-descriptions` extractor
This commit is contained in:
Mark Olesen 2023-10-19 21:25:55 +02:00
parent 870c6a6924
commit 0343ab00f3
20 changed files with 1642 additions and 57 deletions

View File

@ -24,9 +24,10 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-circulator
Test-Circulator
Description
Tests for Circulator and ConstCirculator
\*---------------------------------------------------------------------------*/

View File

@ -25,8 +25,10 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-DLList
Description
Tests for doubly-linked lists
\*---------------------------------------------------------------------------*/

View File

@ -25,8 +25,10 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-Dictionary
Description
Tests for Dictionary (not dictionary)
\*---------------------------------------------------------------------------*/

View File

@ -95,13 +95,13 @@ See Also
SourceFiles
DirListerI.H
DirLister.C
DirListerTemplates.C
DirLister.cxx
DirLister.txx
\*---------------------------------------------------------------------------*/
#ifndef DirLister_H
#define DirLister_H
#ifndef Foam_DirLister_H
#define Foam_DirLister_H
#include "fileNameList.H"
#include "wordList.H"
@ -134,7 +134,7 @@ protected:
// Protected Member Functions
//- Placeholder for additional selection filters
virtual inline bool accept(const word& name) const;
virtual inline bool accept(const word& name) const { return true; }
//- Traverse to next entry
word next(DIR* dirPtr) const;
@ -189,8 +189,7 @@ public:
// Member Functions
//- Return the directory name
inline const fileName& dirName() const;
const fileName& dirName() const noexcept { return dirName_; }
//- Return a complete list of names
template<class StringType=Foam::word>
@ -246,7 +245,7 @@ public:
inline ~const_iterator();
inline const_iterator& operator++();
inline const word& operator*() const;
const word& operator*() const noexcept { return name_; }
inline bool operator==(const const_iterator& iter) const;
inline bool operator!=(const const_iterator& iter) const;
@ -275,7 +274,10 @@ protected:
friend class DirLister;
virtual inline bool accept(const word& name) const;
virtual inline bool accept(const word& name) const
{
return (pred_(name) ? !prune_ : prune_);
}
//- Constructor
inline Filtered
@ -295,10 +297,7 @@ protected:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "DirListerI.H"
#ifdef NoRepository
#include "DirListerTemplates.C"
#endif
#include "DirLister.txx"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -25,24 +25,6 @@ License
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
inline bool Foam::DirLister::accept(const word& name) const
{
return true;
}
template<class UnaryPredicate>
inline bool Foam::DirLister::Filtered<UnaryPredicate>::accept
(
const word& name
) const
{
return (pred_(name) ? !prune_ : prune_);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::DirLister::DirLister
@ -103,14 +85,6 @@ Foam::DirLister::where(const UnaryPredicate& pred, const bool prune) const
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::fileName& Foam::DirLister::dirName() const
{
return dirName_;
}
// * * * * * * * * * * * * * * * Const Iterator * * * * * * * * * * * * * * //
inline Foam::DirLister::const_iterator::const_iterator()
@ -143,12 +117,6 @@ inline Foam::DirLister::const_iterator::~const_iterator()
}
inline const Foam::word& Foam::DirLister::const_iterator::operator*() const
{
return name_;
}
Foam::DirLister::const_iterator&
Foam::DirLister::const_iterator::operator++()
{

View File

@ -1,4 +1,4 @@
Test-DirLister.C
DirLister.C
Test-DirLister.cxx
DirLister.cxx
EXE = $(FOAM_USER_APPBIN)/Test-DirLister

View File

@ -1,2 +1,2 @@
/* EXE_INC = -I$(LIB_SRC)/finiteVolume/lnInclude */
/* EXE_LIBS = -lfiniteVolume */
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -24,7 +24,11 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-DynamicField
Description
Tests for DynamicField base functionality
\*---------------------------------------------------------------------------*/

View File

@ -24,7 +24,11 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-DynamicList
Description
Tests for DynamicList base functionality
\*---------------------------------------------------------------------------*/

View File

@ -24,7 +24,11 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-HashPtrTable
Description
Tests for HashPtrTable base functionality
\*---------------------------------------------------------------------------*/

1444
applications/test/README.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,160 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2023 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# Script
# get-descriptions
#
# Description
# Extract descriptions from test applications
#
# Requires
# perl
#
#------------------------------------------------------------------------------
scriptPath="$(realpath "$0")" # Capture realpath before changing directory
cd "${0%/*}" || exit # Run from this directory
printHelp() {
cat<<USAGE
usage: ${0##*/} [OPTION]
options:
-git Use git to retrieve the tutorials
-no-git Do not use git to retrieve the tutorials
-help Print the usage
Extract descriptions from test applications.
Detects and uses 'git' to obtain a fresh set of files when possible.
USAGE
exit 0 # A clean exit
}
# Report error and exit
die()
{
exec 1>&2
echo
echo "Error encountered:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo
echo "See '${0##*/} -help' for usage"
echo
exit 1
}
#------------------------------------------------------------------------------
useGit=auto
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h* | -help*) printHelp ;;
-git)
useGit=true
;;
-no-git)
unset useGit
;;
*)
die "Unknown option/argument: '$1'"
;;
esac
shift
done
if [ -n "$useGit" ]
then
if git rev-parse --is-inside-work-tree > /dev/null 2>&1
then
gitbase="$(git rev-parse --show-toplevel 2>/dev/null)"
fi
case "$useGit" in
auto)
if [ -n "$gitbase" ]
then
echo "Detected git repository" 1>&2
else
echo "No git repository detected" 1>&2
fi
;;
true)
[ -n "$gitbase" ] || die "Not in a git repository"
;;
esac
fi
if [ -n "$gitbase" ]
then
git ls-tree --name-only -r HEAD
else
find . -maxdepth 2 -name '*.C' -o -name '*.cpp' -o -name '*.cxx'
fi | \
perl -ne 's{^\./}{}; m{^[^/]+/[^/]+?\.(?:C|cpp|cxx)$} and print' | sort |\
while read file
do
# echo "process $file" 1>&2
perl -x "$scriptPath" "$file"
done
exit 0
#------------------------------------------------------------------------------
#!/usr/bin/perl -w
use strict;
my $state = undef;
while (<>) {
unless ( defined $state ) {
my ( $dir, $file ) = $ARGV =~ m{^(.+?)/(.+)$};
$file =~ s{\.(?:C|cpp|cxx)$}{}; # strip extension
## Restrict to files starting with "Test"
if ( $file =~ m{^Test}i ) {
print "\n## $file (directory: $dir)\n\n";
$state = 0;
}
else {
$state = -1; # Unwanted file
}
next;
}
if (/^Description/) {
$state = 1 unless $state;
}
elsif (m{\*/}) # End C-comment
{
print "- no description\n" unless $state;
## print "done: $_";
$state = 2;
}
elsif ( $state == 1 ) {
## s/^\s{4}//; # Strip leading 4-spaces
print;
}
}
continue {
if (eof) { # Not eof()
undef $state;
close ARGV;
}
}
#------------------------------------------------------------------------------

View File

@ -87,9 +87,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "Gather.C"
#endif
#include "Gather.txx"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -93,9 +93,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "GatherBase.C"
#endif
#include "GatherBase.txx"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,7 +24,8 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Test TimePaths and timeSelectop
Test TimePaths and timeSelector
\*---------------------------------------------------------------------------*/
#include "argList.H"