The Use of Assert() in SQLite

The Use of Assert() in SQLite

The testcase(X) macro is normally a no-op, but for a coverage test build it does generate a small amount of extra code that includes at least one branch, in order to verify that test cases exist for which X is both true and false. ALWAYS(X) and NEVER(X) functions are used in places where we always want the test to occur even though the developers believe the value of X is always true or false. We know that the cursor is on the list, so that the loop must terminate by the “break” statement, but it is convenient to use the ALWAYS(X) test at to prevent running off the end of the linked list in case there is an error in some other part of the code that has corrupted the linked list.

Source: www.sqlite.org