Skip to content

Commit

Permalink
fix unit tests for smartSimFunctionObject
Browse files Browse the repository at this point in the history
  • Loading branch information
FoamScience committed Oct 28, 2023
1 parent 0ce4ac2 commit a87ddbf
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
1 change: 0 additions & 1 deletion .github/workflows/smartsim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ jobs:
cd $FOAM_FOAMUT || exit 1
rm -rf tests/exampleTests
./Alltest "$@"
if [ -f $FOAM_FOAMUT/tests/adaptiveFvMeshTests/log.wmake ]; then cat $FOAM_FOAMUT/tests/adaptiveFvMeshTests/log.wmake; fi
39 changes: 28 additions & 11 deletions 2023-01/smartsim/smartsim_function_object/tests/smartSimFOTest.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,39 @@
#include "fvCFD.H"
#include "fvMesh.H"

#include <csetjmp>
#include <csignal>
#include <cstdlib>
#include <functional>
#include "smartSimFunctionObject.H"
#include "functionObjectList.H"

using namespace Foam;
extern Time* timePtr;
extern argList* argsPtr;

TEST_CASE("Shared SmartRedis client", "[cavity][serial][parallel]")
{
dictionary dict;
dict.set("type", "smartSimFunctionObject");
dict.set("fieldNames", wordList());
dict.set("fieldDimensions", labelList());
functionObjects::smartSimFunctionObject fo1("smartSimFo1", *timePtr, dict);
functionObjects::smartSimFunctionObject fo2("smartSimFo2", *timePtr, dict);
REQUIRE(&fo1.redisDB == &fo2.redisDB);
Time& runTime = *timePtr;
FatalError.dontThrowExceptions();
fvMesh mesh
(
IOobject
(
polyMesh::defaultRegion,
runTime.constant(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
dictionary dict0;
dict0.set("region", polyMesh::defaultRegion);
dict0.set("type", "smartSimFunctionObject");
dict0.set("fieldNames", wordList());
dict0.set("fieldDimensions", labelList());
dictionary dict1;
dict1.set("region", polyMesh::defaultRegion);
dict1.set("type", "smartSimFunctionObject");
dict1.set("fieldNames", wordList());
dict1.set("fieldDimensions", labelList());
functionObjects::smartSimFunctionObject o0("smartSim0", runTime, dict0);
functionObjects::smartSimFunctionObject o1("smartSim1", runTime, dict1);
REQUIRE(&(o0.redisDB) == &(o1.redisDB));
}

0 comments on commit a87ddbf

Please sign in to comment.