SQLite has about 155,800 lines of code, and its test suite has roughly 92 million lines. That is ~590x more test code than actual code 🤯
This is the level of testing you need for a real production database. Here are some types of tests they run.
Out-of-memory tests - SQLite cannot just crash when memory runs out. On embedded devices, OOM errors are common. They simulate malloc failures at every possible point and verify that the database handles them gracefully.
I/O error tests - Disks fail. Networks drop. Permissions change mid-operation. SQLite inserts a custom file system layer that can simulate failures after N operations, then verifies that no corruption occurs.
Crash tests - What happens if power cuts out mid-write? They simulate crashes at random points during writes, corrupt the unsynchronized data to mimic real filesystem behavior, then verify the database either completed the transaction or rolled it back cleanly. No corruption allowed.
Fuzz testing - They throw malformed SQL, corrupted database files, and random garbage at SQLite. The dbsqlfuzz tool runs about 500 million test mutations every day across 16 cores.
100% branch coverage - Every single branch instruction in SQLite's core is tested in both directions. Not just 'did this line run', but 'did this condition evaluate to both true AND false'.
Databases are really unforgiving :)
By the way, if you want to go deeper, I recommend reading the official SQLite documentation on their testing strategy. The doc is pretty practical and deep.
Have linked it below.