Adding unit tests and docs for `>`, `>=` and `<=`.

Also fixing the bugs that were exposed, and adding further TODOs.