Skip to content

Commit

Permalink
Replaced assert with assert_equal in C++ unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaudin47 committed Oct 7, 2024
1 parent 39d39f0 commit c828539
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/test/t_ExperimentIntegration_std.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ int main(int, char *[])

fullprint << "Test integrate()" << std::endl;
const Point ishigamiMeanComputed(integration.integrate(ishigamiFunction));
assert(ishigamiMeanComputed.getDimension() == 1);
assert_equal(ishigamiMeanComputed.getDimension(), (UnsignedInteger) 1);
fullprint << " ishigamiMeanComputed[0] = " << ishigamiMeanComputed[0] << std::endl;
fullprint << " mean = " << mean << std::endl;
assert_almost_equal(ishigamiMeanComputed[0], mean, atolIntegrate);

fullprint << "Test computeL2Norm()" << std::endl;
const Point centeredIshigamiL2Norm(integration.computeL2Norm(centeredIshigami));
assert(centeredIshigamiL2Norm.getDimension() == 1);
assert_equal(centeredIshigamiL2Norm.getDimension(), (UnsignedInteger) 1);
fullprint << " centeredIshigamiL2Norm[0] = " << centeredIshigamiL2Norm[0] << std::endl;
fullprint << " exactL2Norm = " << exactL2Norm << std::endl;
assert_almost_equal(centeredIshigamiL2Norm[0], exactL2Norm, atolIntegrate);
Expand All @@ -83,7 +83,7 @@ int main(int, char *[])

fullprint << "Test computeL2Norm()" << std::endl;
const Point ishigamiErrorComputed(integration.computeL2Norm(ishigamiFunction - ishigamiPartFunction));
assert(ishigamiErrorComputed.getDimension() == 1);
assert_equal(ishigamiErrorComputed.getDimension(), (UnsignedInteger) 1);
Scalar errorExact = std::sqrt(0.5);
fullprint << " ishigamiErrorComputed[0] = " << ishigamiErrorComputed[0] << std::endl;
fullprint << " errorExact = " << errorExact << std::endl;
Expand Down
6 changes: 3 additions & 3 deletions lib/test/t_MonteCarloExperiment_std.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ int main(int, char *[])
fullprint << "experiment = " << experiment << std::endl;
Point weights(0);
const Sample sample(experiment.generateWithWeights(weights));
assert(sample.getSize() == size);
assert(sample.getDimension() == 4);
assert(weights.getDimension() == size);
assert_equal(sample.getSize(), size);
assert_equal(sample.getDimension(), (UnsignedInteger) 4);
assert_equal(weights.getDimension(), size);
const Scalar atol = 10.0 / std::sqrt(size);
const Scalar rtol = 0.0;
const Point meanExact(distribution.getMean());
Expand Down

0 comments on commit c828539

Please sign in to comment.