summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2017-06-21 22:13:40 +0300
committerIgor Pashev <pashev.igor@gmail.com>2017-06-21 22:13:40 +0300
commit8c22ae8bf2040179ab1029900004b7ceb70ef0f9 (patch)
tree2a2361d9c9d9c611359024c82c34f93bcb17766d
parent9a9a8b3291447aa168876e13768a68db32193f34 (diff)
downloadlibept-8c22ae8bf2040179ab1029900004b7ceb70ef0f9.tar.gz
tests: exp10(x) -> exp(x * log(10))
exp10() is a GNU extention.
-rw-r--r--ept/utils/tests.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/ept/utils/tests.cc b/ept/utils/tests.cc
index 28ea280..5c19bcc 100644
--- a/ept/utils/tests.cc
+++ b/ept/utils/tests.cc
@@ -14,6 +14,9 @@
#include <sys/types.h>
#include <regex.h>
+#define _ept_log10 ((double) 2.30258509299)
+
+
using namespace std;
using namespace ept;
@@ -339,7 +342,7 @@ void ActualStdString::not_matches(const std::string& re) const
void ActualDouble::almost_equal(double expected, unsigned places) const
{
- if (round((_actual - expected) * exp10(places)) == 0.0)
+ if (round((_actual - expected) * exp(places * _ept_log10)) == 0.0)
return;
std::stringstream ss;
ss << std::setprecision(places) << fixed << _actual << " is different than the expected " << expected;
@@ -348,7 +351,7 @@ void ActualDouble::almost_equal(double expected, unsigned places) const
void ActualDouble::not_almost_equal(double expected, unsigned places) const
{
- if (round(_actual - expected * exp10(places)) != 0.0)
+ if (round(_actual - expected * exp(places * _ept_log10)) != 0.0)
return;
std::stringstream ss;
ss << std::setprecision(places) << fixed << _actual << " is the same as the expected " << expected;