Implemented test for operator< generation.

I checked it and your fixes fix the problem. If you want the test merged in to prevent future regressions etc., please merge.