Arcane  v3.14.10.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
Assertion.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* Assertion.cc (C) 2000-2020 */
9/* */
10/* Ensemble d'assertions utilisées pour les tests unitaires. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/Assertion.h"
15
16#include "arcane/IParallelMng.h"
17
18/*---------------------------------------------------------------------------*/
19/*---------------------------------------------------------------------------*/
20
21namespace Arcane
22{
23
24void Assertion::
25_checkAssertion(bool is_error,const TraceInfo& where,
26 const String& expected, const String& actual, IParallelMng* pm)
27{
28 bool global_error = is_error;
29 if (pm){
30 Int32 e = (is_error) ? 1 : 0;
31 Int32 ge = pm->reduce(Parallel::ReduceSum,e);
32 global_error = (ge!=0);
33 }
34 if (global_error)
35 throw AssertionException(where, expected, actual);
36}
37
38/*---------------------------------------------------------------------------*/
39/*---------------------------------------------------------------------------*/
40
41} // End namespace Arcane
42
43/*---------------------------------------------------------------------------*/
44/*---------------------------------------------------------------------------*/
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-