diff --git a/applications/test/exprTraits/Make/files b/applications/test/exprTraits/Make/files new file mode 100644 index 0000000000..6ae37c355d --- /dev/null +++ b/applications/test/exprTraits/Make/files @@ -0,0 +1,3 @@ +Test-exprTraits.C + +EXE = $(FOAM_USER_APPBIN)/Test-exprTraits diff --git a/applications/test/exprTraits/Make/options b/applications/test/exprTraits/Make/options new file mode 100644 index 0000000000..18e6fe47af --- /dev/null +++ b/applications/test/exprTraits/Make/options @@ -0,0 +1,2 @@ +/* EXE_INC = */ +/* EXE_LIBS = */ diff --git a/applications/test/exprTraits/Test-exprTraits.C b/applications/test/exprTraits/Test-exprTraits.C new file mode 100644 index 0000000000..3dee3b436f --- /dev/null +++ b/applications/test/exprTraits/Test-exprTraits.C @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | www.openfoam.com + \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2021 OpenCFD Ltd. +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM, distributed under GPL-3.0-or-later. + +Description + Basic tests of expression traits + +\*---------------------------------------------------------------------------*/ + +#include "IOstreams.H" +#include "ITstream.H" +#include "exprTraits.H" +#include "uLabel.H" +#include "error.H" +#include "stringList.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +void printTraits() +{ + const auto typeCode = exprTypeTraits::value; + + Info<< "type " << pTraits::typeName + << " code:" << int(typeCode) + << " name:" << exprTypeTraits::name; + + if (pTraits::typeName != word(exprTypeTraits::name)) + { + Info<< " (UNSUPPORTED)"; + } + + Info << endl; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main() +{ + Info<< nl << "Traits:" << nl; + + printTraits(); + printTraits(); + printTraits(); + printTraits