Skip to content

Commit 4ec65d4

Browse files
Merge pull request #2130 from arcaneframework/dev/gg-add-test-for-nan-in-caseoption
Add test to read NaN value in case file
2 parents 813a5ef + 24f2dc0 commit 4ec65d4

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

arcane/src/arcane/tests/CaseOptionsTester.axl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,14 @@
361361
<description>InfinityByDefault</description>
362362
</simple>
363363

364+
<simple
365+
name = "nan-real"
366+
type = "real"
367+
default = "nan"
368+
>
369+
<description>NanByDefault</description>
370+
</simple>
371+
364372
<!-- - - - - - extended-real-int-with-default - - - - -->
365373
<extended
366374
name = "extended-real-int-with-default"

arcane/src/arcane/tests/CaseOptionsTesterModule.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
22
//-----------------------------------------------------------------------------
3-
// Copyright 2000-2023 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
3+
// Copyright 2000-2025 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
44
// See the top-level COPYRIGHT file for details.
55
// SPDX-License-Identifier: Apache-2.0
66
//-----------------------------------------------------------------------------
77
/*---------------------------------------------------------------------------*/
8-
/* CaseOptionsTesterModule.cc (C) 2000-2023 */
8+
/* CaseOptionsTesterModule.cc (C) 2000-2025 */
99
/* */
1010
/* Module de test des options du jeu de données. */
1111
/*---------------------------------------------------------------------------*/
@@ -484,7 +484,8 @@ init()
484484
info() << " SimpleInteger=" << options()->simpleInteger.name();
485485
info() << " SimpleBool= " << options()->simpleBool;
486486
info() << " SimpleString= " << options()->simpleString;
487-
info() << " InfinityReal = " << options()->infinityReal();
487+
info() << " InfinityReal= " << options()->infinityReal();
488+
info() << " NaNReal= " << options()->nanReal();
488489
info() << " SimpleEnumWithFunction = " << options()->simpleEnumFunction.name();
489490
info() << " Complex1/SimpleReal-2 = " << options()->complex1.simpleReal2;
490491
info() << " Complex1/SimpleReal3-2 = " << options()->complex1.simpleReal32;
@@ -523,6 +524,11 @@ init()
523524
UniqueArray<Real> v0 = { 5.2, 2.3 };
524525
vc.areEqual(options()->complex1.getSimpleReal2Multi(),v0.constView(),"SimpleReal2Multi");
525526
}
527+
{
528+
vc.areEqual(options()->infinityReal(),std::numeric_limits<Real>::infinity(),"RealInfinity");
529+
if (!std::isnan(options()->nanReal()))
530+
ARCANE_FATAL("Value is not 'NaN' : '{0}'",options()->nanReal());
531+
}
526532
if (options()->testId()==4){
527533
vc.areEqual(options()->simpleRealWithDefault(),3.0,"setDefaultValue() for real");
528534
vc.areEqual(options()->simpleIntegerWithDefault(),99,"setDefaultValue() for integer");

0 commit comments

Comments
 (0)