Finish implementation of the diff view.

This commit
* Moves the diffing algorithm out of the view.
* Adds tests for the diffing algorithm.
* Adds tests for the streams helper function.