Skip to content

Commit

Permalink
Fixed OFnumeric_limits unit tests.
Browse files Browse the repository at this point in the history
Replaced use of C++11 member function by code that also works with C++98.
  • Loading branch information
Marco Eichelberg committed Mar 5, 2024
1 parent 5714b4c commit f8e6414
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ofstd/tests/tlimits.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*
* Copyright (C) 2014-2018, OFFIS e.V.
* Copyright (C) 2014-2024, OFFIS e.V.
* All rights reserved. See COPYRIGHT file for details.
*
* This software and supporting documentation were developed by
Expand Down Expand Up @@ -42,7 +42,9 @@ template<typename T>
static void checkMinMax()
{
volatile T max_plus_one( OFnumeric_limits<T>::max() );
volatile T lowest_minus_one( OFnumeric_limits<T>::lowest() );
volatile T lowest;
if (OFnumeric_limits<T>::is_integer) lowest = OFnumeric_limits<T>::min(); else lowest = -OFnumeric_limits<T>::max();
volatile T lowest_minus_one(lowest);
++max_plus_one;
--lowest_minus_one;
OFCHECK
Expand All @@ -52,10 +54,9 @@ static void checkMinMax()
);
OFCHECK
(
OFnumeric_limits<T>::lowest() <= lowest_minus_one ||
lowest <= lowest_minus_one ||
( OFnumeric_limits<T>::has_infinity && OFMath::isinf( lowest_minus_one ) )
);
OFCHECK( ( OFnumeric_limits<T>::lowest() == OFnumeric_limits<T>::min() ) || !OFnumeric_limits<T>::is_integer );
}
#include DCMTK_DIAGNOSTIC_POP

Expand Down

0 comments on commit f8e6414

Please sign in to comment.