This is not the current version of the class.

Lecture 5: Buddy allocation, testing

Part 1: Kernel allocation and buddy allocation (PPT)

Part 2: Testing and defensive programming

Overview

Terms

Validation 1: Testing

Unit tests

Integration tests

Testing goals

How should we measure a test suite?

Example specification

// This function treats `a` and `b` as mathematical integers
// and returns `min(INT_MAX, max(a + b, INT_MIN))`.
int saturating_add(int a, int b);

(Ref: Testing with pictures)

Coverage

Validation 2: Proving

Defensive programming

Invariants

Classes of invariant

Assertions

Assertion patterns

Test suite construction

Debugging

Exercise