Bug 865931 - Fix varous minor problems with the comparison routines, add test r=shu