# Writing a test

A test is a sentence that names it, then a body of ordinary code. In the
body, `assert` fails the test when its condition is false. Here a test
checks a function that says whether a todo is overdue:

```jadpo
// domains/planning/libraries/due_dates.test.jadpo
use planning/types { DueAt }

test "a todo due yesterday is overdue" {
    var due: DueAt = "2026-01-14T12:00:00Z"
    var now: DueAt = "2026-01-15T12:00:00Z"
    assert due_dates.is_overdue(due, now)
}
```

`due_dates` is a library in the `planning` domain, and `is_overdue` is one
of its functions. `DueAt` is the domain's type for a due date, an
`Instant`. The test sits beside the library's file, so it calls the
library without importing it.

## The sentence names the test

A test's sentence is its name, and it is used once in the whole project.
A second test with the same sentence is `semantic.duplicate_declaration`.
Jadpo's records know a test by the file it sits beside and its sentence
([Stable identity](stable-identity.md)).

## Each test starts from nothing

Each test gets its own empty database, its own clock and its own fakes.
So tests never depend on each other, and they can run in any order.
