ENH: support scalar tokens when testing #if, #ifeq

- this allows use of #eval results in the tests
This commit is contained in:
Mark Olesen
2019-11-19 09:00:00 +01:00
committed by Andrew Heather
parent 0838d121c6
commit a5a222f7cf
6 changed files with 71 additions and 16 deletions

View File

@ -1,16 +1,16 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1906 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2;
format ascii;
class dictionary;
object dictionary;
version 2.0;
format ascii;
class dictionary;
object dictionary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -26,3 +26,5 @@ FoamFile
#else
version "other";
#endif
// ************************************************************************* //

View File

@ -0,0 +1,32 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v1912 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object dictionary;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Do comparison
#if #eval "${FOAM_API:-0}"
foamApi nonZero;
#else
foamApi zeroValue;
#endif
#if #eval "${XX_XXX_FOAM_API:-1000}"
other "some entry";
#else
other "unexpected";
#endif
// ************************************************************************* //