mirror of https://github.com/vitalif/openscad
Attempt to batte floating point rounding differences for testing purposes
parent
3f0a991a3d
commit
42d7099089
13
src/value.cc
13
src/value.cc
|
@ -363,7 +363,20 @@ std::string Value::toString() const
|
|||
<< ']';
|
||||
break;
|
||||
case NUMBER:
|
||||
#ifdef OPENSCAD_TESTING
|
||||
// Quick and dirty hack to work around floating point rounding differences
|
||||
// across platforms for testing purposes.
|
||||
{
|
||||
std::stringstream tmp;
|
||||
tmp.precision(16);
|
||||
tmp << this->num;
|
||||
std::string tmpstr = tmp.str();
|
||||
if (tmpstr.size() > 16) tmpstr.erase(16);
|
||||
stream << tmpstr;
|
||||
}
|
||||
#else
|
||||
stream << this->num;
|
||||
#endif
|
||||
break;
|
||||
case BOOL:
|
||||
stream << (this->b ? "true" : "false");
|
||||
|
|
|
@ -199,6 +199,7 @@ include_directories(${CGAL_INCLUDE_DIRS})
|
|||
include_directories(../src)
|
||||
|
||||
add_definitions(-DOPENSCAD_VERSION=test -DOPENSCAD_YEAR=2011 -DOPENSCAD_MONTH=10)
|
||||
add_definitions(-DOPENSCAD_TESTING)
|
||||
|
||||
set(CORE_SOURCES
|
||||
tests-common.cc
|
||||
|
|
|
@ -1 +1 @@
|
|||
ECHO: 3.141592653589793
|
||||
ECHO: 3.14159265358979
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
WARNING: Unsupported DXF Entity `LEADER' (1) in `dim-all.dxf'.
|
||||
ECHO: linearX = 51.44957554275265
|
||||
ECHO: linearX = 51.4495755427526
|
||||
WARNING: Unsupported DXF Entity `LEADER' (1) in `dim-all.dxf'.
|
||||
ECHO: linearY = 29.13025467434841
|
||||
ECHO: linearY = 29.1302546743484
|
||||
WARNING: Unsupported DXF Entity `LEADER' (1) in `dim-all.dxf'.
|
||||
ECHO: aligned = 60.00000000000001
|
||||
ECHO: aligned = 60.0000000000000
|
||||
WARNING: Unsupported DXF Entity `LEADER' (1) in `dim-all.dxf'.
|
||||
ECHO: ordinateX = -49.17542445724735
|
||||
ECHO: ordinateX = -49.175424457247
|
||||
WARNING: Unsupported DXF Entity `LEADER' (1) in `dim-all.dxf'.
|
||||
ECHO: ordinateY = 30.86974532565159
|
||||
ECHO: ordinateY = 30.8697453256515
|
||||
WARNING: Unsupported DXF Entity `LEADER' (1) in `dim-all.dxf'.
|
||||
ECHO: radius = 60
|
||||
WARNING: Unsupported DXF Entity `LEADER' (1) in `dim-all.dxf'.
|
||||
ECHO: diameter = 120
|
||||
WARNING: Unsupported DXF Entity `LEADER' (1) in `dim-all.dxf'.
|
||||
ECHO: arc = 59.03624346792648
|
||||
ECHO: arc = 59.0362434679264
|
||||
|
|
Loading…
Reference in New Issue