tests and implementation for `add/3`