Bug 10426 – Improve code coverage of std.random unittests

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-20T13:12:00Z
Last change time
2013-06-29T07:25:18Z
Assigned to
nobody
Creator
joseph.wakeling

Comments

Comment #0 by joseph.wakeling — 2013-06-20T13:12:46Z
std.random's unittests currently only cover 79% of the module. The main culprit is RandomSample.skip() where, due to the change in algorithm in commit ae15e0ec1459d2af5e1b99eda0d4a44527ab6a29, the pre-existing unittests fail to cope. The new algorithm uses two different methods depending on the ratio of sample points to available points, and the consistent 5:10 ratio in all the unittests means one of these methods is being avoided. Some code coverage "failures" are irrelevant -- e.g. methods of the dummy ranges used to unittest isUniformRNG and isSeedable from lines 179-242, assert(false) statements that should never be reached, or text() calls in asserts that do not fail. Others seem to be down to problems the coverage analyser has with compile-time evaluations -- e.g. the static methods in LinearCongruentialEngine or static conditionals that don't get satisfied. Finally, many objects seem to have some small parts that are never tested -- for some reason .save methods seem particularly prone to not being checked in the unittests.
Comment #1 by github-bugzilla — 2013-06-29T07:21:46Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/b135fe92931ac7319999a0f291e69cdfa1cb381c Merge pull request #1357 from WebDrake/random-testcoverage Issue 10426 - Improve code coverage of std.random unittests
Comment #2 by andrej.mitrovich — 2013-06-29T07:25:18Z