unit testing is usually associated with TDD, a famous technique for developing software. In TDD, tests are written before implementing the actual production code, in small steps, to help the system grow organically.
The TDD is performed in a cycle:
- Write a test
- Make the test pass
- Refactor the code to remove the duplication and prepare for the next test
There is more to it than that, but let's see an example of how to do TDD in Swift.
As a simple example, we'll implement a basic RPN Calculator.