From a87ddbff773c7c32ebcf7d1cdaa8e512d33c806d Mon Sep 17 00:00:00 2001 From: Elwardi Date: Sat, 28 Oct 2023 15:52:18 +0200 Subject: [PATCH] fix unit tests for smartSimFunctionObject --- .github/workflows/smartsim.yaml | 1 - .../tests/smartSimFOTest.C | 39 +++++++++++++------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.github/workflows/smartsim.yaml b/.github/workflows/smartsim.yaml index 7b6d0b02..36f13c5b 100644 --- a/.github/workflows/smartsim.yaml +++ b/.github/workflows/smartsim.yaml @@ -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 diff --git a/2023-01/smartsim/smartsim_function_object/tests/smartSimFOTest.C b/2023-01/smartsim/smartsim_function_object/tests/smartSimFOTest.C index ab7df7b3..054e63dc 100644 --- a/2023-01/smartsim/smartsim_function_object/tests/smartSimFOTest.C +++ b/2023-01/smartsim/smartsim_function_object/tests/smartSimFOTest.C @@ -5,10 +5,8 @@ #include "fvCFD.H" #include "fvMesh.H" -#include -#include -#include -#include +#include "smartSimFunctionObject.H" +#include "functionObjectList.H" using namespace Foam; extern Time* timePtr; @@ -16,11 +14,30 @@ 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)); }