Add working lib to tests.

Uses `build` function to simplify repetitive directory creation.