Testing checks whether software still behaves as expected after changes. REPL checks are useful during development, but larger projects need repeatable tests that expose regressions across many files. section 16.5
A Julia package test suite lives in test/runtests.jl and runs separately from the module under test. The test environment imports both the package and Julia's Test package. section 16.5
A practical package-testing setup uses:
- A test directory containing runtests.jl and focused files such as trigtests.jl. section 16.5
- Nested @testset blocks, where an enclosing set succeeds only when its contained sets succeed. section 16.5
Catching and fixing a cosine regression
ToyGeometry tests compare cosine(π) and cosine(0) with expected values, then compare cosine against cos across 0:0.1:2π. An initial run reports 108 passes and 22 failures. Increasing the cosine approximation's series limit from 5 to 9 makes all 130 tests pass.




















































