SQLite testing procedures
Robert Clipsham
robert at octarineparrot.com
Fri Aug 5 13:13:17 PDT 2011
This is a fairly old document now, but it has some interesting ideas
that could have a place in D (either the language, tools, or phobos):
http://www.sqlite.org/testing.html
Some notable things other than the range of testing methods used:
* 100% branch test coverage (7.1)
- It would be nice if dmd's -cov offered a way to give the coverage
for statements and branches rather than just per line
* Coverage testing of defensive code (7.2)
- Some branches are always (or never) executed, which can mean 100%
branch coverage is not possible unless you remove the "defensive" code.
- SQLite solves this with the ALWAYS() and NEVER() macros
- This would only become relevant if -cov was improved
* Forcing coverage of boundary values and boolean vector tests (7.3)
- SQLite has a testcase() macro which adds additional branches
during coverage analysis to test boundary conditions and similar.
- D currently has no way of doing this, it would be a simple (and
useful) addition to phobos though.
* SQLite makes extensive use of assert().
* The SQLite developers have found static analysis to be completely
useless compared to having extensive (100%) coverage tests, as well as
help from tools such as valgrind (particularly praised in the above).
They've even found themselves introducing bugs while trying to silence
compiler warnings!
--
Robert
http://octarineparrot.com/
More information about the Digitalmars-d
mailing list