From 11319a397afbc7808e345221d7cf90eb77628057 Mon Sep 17 00:00:00 2001 From: Rikard Falkeborn Date: Sun, 10 Nov 2019 08:27:55 +0100 Subject: [PATCH] ValueFlow: Add test with hexadecimal floating point literal (#2342) --- test/testvalueflow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index ca8b00bce..d0de223a2 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -323,6 +323,7 @@ private: void valueFlowNumber() { ASSERT_EQUALS(123, valueOfTok("x=123;", "123").intvalue); + ASSERT_EQUALS_DOUBLE(192.0, valueOfTok("x=0x0.3p10;", "0x0.3p10").floatValue, 1e-5); // 3 * 16^-1 * 2^10 = 192 ASSERT(std::fabs(valueOfTok("x=0.5;", "0.5").floatValue - 0.5f) < 0.1f); ASSERT_EQUALS(10, valueOfTok("enum {A=10,B=15}; x=A+0;", "+").intvalue); ASSERT_EQUALS(0, valueOfTok("x=false;", "false").intvalue);