digitalmars.D.bugs - [Issue 14774] New: core.time.numToString(double) fails its unit
- via Digitalmars-d-bugs (38/38) Jul 06 2015 https://issues.dlang.org/show_bug.cgi?id=14774
https://issues.dlang.org/show_bug.cgi?id=14774 Issue ID: 14774 Summary: core.time.numToString(double) fails its unit tests in non-release mode Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: issues.dlang jmdavisProg.com only run in non-release mode right now, so stuff like range violations in the tests typically aren't caught. In particular, the tests for numToString(double) in core.time fail due to range violations (it's resulting in "0.3" and not "0.33")) when built without -release, but by some quirk of the implementation, the resulting slice matches the string that it's being tested against even 4844: unittest { auto a = 1.337; auto aStr = numToString(a); assert(aStr[0 .. 4] == "1.33", aStr); a = 0.337; aStr = numToString(a); assert(aStr[0 .. 4] == "0.33", aStr); a = -0.337; aStr = numToString(a); assert(aStr[0 .. 5] == "-0.33", aStr); } You can also just mark the unittest block with safe rather than editing the makefile to build druntime without -release. And if you do, the second and third tests fail. --
Jul 06 2015