Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 129ae52

Browse files
Test Stream::parseFloat() with many digits
1 parent 78f3f41 commit 129ae52

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎test/src/Stream/test_parseFloat.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#include <StreamMock.h>
1212

13+
#include <float.h>
14+
1315
/**************************************************************************************
1416
* TEST CODE
1517
**************************************************************************************/
@@ -43,6 +45,11 @@ TEST_CASE ("Testing parseFloat(LookaheadMode lookahead = SKIP_ALL, char ignore =
4345
mock << "\r\n\t 12.34";
4446
REQUIRE(mock.parseFloat() == 12.34f);
4547
}
48+
WHEN ("A float is provided with too many digits")
49+
{
50+
mock << "3.1415926535897932384";
51+
REQUIRE(abs(mock.parseFloat() - 3.141592654f) < 8 * FLT_EPSILON);
52+
}
4653
}
4754

4855
TEST_CASE ("Testing parseFloat(LookaheadMode lookahead = SKIP_NONE, char ignore = NO_IGNORE_CHAR)", "[Stream-parseFloat-02]")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /