Added a test fixture.
Implemented the algorithm, added a test.