Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite's test code to production code ratio

SQLite claim to have 679 times more test code than production one. http://www.sqlite.org/testing.html

Does anyone knows how it is possible? Do they generate any test code automatically? What are the major parts of these "45678.3 KSLOC" of test code?

like image 804
kopper Avatar asked Mar 31 '10 21:03

kopper


3 Answers

"Does anyone knows how it is possible?"

"It is possible" to have 679 times as much test code because a single feature can be used in many different ways. Consider just a single function that takes two parameters. I can generate alot of test code for that one function that tests boundary conditions and many other combinations of conditions. When you consider setup/teardown of the tests, there is additional code there. Depending on their testing framework this overhead may significantly add to the amount of code in testing.

What it really boils down to is the fact the a piece of software can be used in so many different ways, which means that you have many different scenarios to test for. This is the beauty of elegant software, in that a simple program can be applied to numerous scenarios, but that is the same thing that makes verifying and testing software so challenging.

like image 109
AaronLS Avatar answered Nov 09 '22 03:11

AaronLS


It's presumably possible if the developers spent 679 times as much time writing test code as they spent writing production code. Just think: if they'd opted instead for 339 times as much test code, they could have had two entire database engines, each still with a ludicrous amount of test coverage.

I once watched a fellow developer trying to placate a furious customer about slipped deadlines by informing them that he had written 5 times as much test code as production code. The customer was not placated, if you can imagine. At least I don't think 5X coverage is extreme anymore.

like image 30
MusiGenesis Avatar answered Nov 09 '22 02:11

MusiGenesis


It uses Tcl to power the test framework so it's much easier to write tests than it is to write the implementation. This encourages thorough testing, which is what you want in a database, yes? Moreover, a fair fraction of those tests are proprietary, aimed at testing in embedded environments; I imagine some corporate user (or users) paid for that sort of thing. It's also quite possible that the same feature is tested multiple times.

like image 1
Donal Fellows Avatar answered Nov 09 '22 04:11

Donal Fellows