Added tests for rating.
Re-implemented rating selection with the bisect algorithm.
Documented setup and usage of tests.