From 18a874b46921adc6f1ffa26fc638c8921762fc17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Cavelan?= Date: Wed, 24 Jul 2024 14:33:21 +0200 Subject: [PATCH] fix calls to now() that were in_update --- model/Clinical/CMDecisionTree.cpp | 2 +- model/Host/Human.cpp | 2 +- unittest/CMDecisionTreeSuite.h | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/model/Clinical/CMDecisionTree.cpp b/model/Clinical/CMDecisionTree.cpp index c201a8fc..cd52798e 100644 --- a/model/Clinical/CMDecisionTree.cpp +++ b/model/Clinical/CMDecisionTree.cpp @@ -183,7 +183,7 @@ class CMDTUncomplicated : public CMDecisionTree { if ( ((hostData.pgState & Episode::SICK) && !(hostData.pgState & Episode::COMPLICATED)) || (hostData.pgState & Episode::MALARIA) ) { - if (latest.time + memory >= sim::now()) + if (latest.time + memory >= sim::nowOrTs0()) return positive.exec( hostData ); else return negative.exec( hostData ); diff --git a/model/Host/Human.cpp b/model/Host/Human.cpp index 797fe4a0..307f0ea1 100644 --- a/model/Host/Human.cpp +++ b/model/Host/Human.cpp @@ -112,7 +112,7 @@ Human::Human(SimTime dateOfBirth) : { // Initial humans are created at time 0 and may have dateOfBirth in past. Otherwise dateOfBirth must be now. assert( dateOfBirth == sim::nowOrTs1() || (sim::now() == sim::zero() && dateOfBirth < sim::now()) ); - + HumanHet het = hetSample(rng); withinHostModel = WithinHost::WHInterface::createWithinHostModel( rng, het.comorbidityFactor ); diff --git a/unittest/CMDecisionTreeSuite.h b/unittest/CMDecisionTreeSuite.h index 173c472d..1d06e56f 100644 --- a/unittest/CMDecisionTreeSuite.h +++ b/unittest/CMDecisionTreeSuite.h @@ -48,7 +48,8 @@ class CMDecisionTreeSuite : public CxxTest::TestSuite UnittestUtil::EmpiricalWHM_setup(); - human.reset( UnittestUtil::createHuman(sim::zero()).release() ); + human.reset( UnittestUtil::createHuman(sim::nowOrTs0()).release() ); + ETS_ASSERT( human.get() != 0 ); whm = dynamic_cast(UnittestUtil::setHumanWH( *human, unique_ptr(new WHMock()) ));