Test comparison operators
import dshould; import std.algorithm: sort; Path[] ap = [ Path("a", "d", "c"), Path("a", "c", "e"), Path("g", "a", "d"), Path("ab", "c", "d"), ]; ap.sort(); // We just compare segments of paths // (to avoid calling code that have to checked by this test in check itself) ap[0].segments.should.equal(Path("a", "c", "e").segments); ap[1].segments.should.equal(Path("a", "d", "c").segments); ap[2].segments.should.equal(Path("ab", "c", "d").segments); ap[3].segments.should.equal(Path("g", "a", "d").segments); ap.sort!("a > b"); // We just compare segments of paths // (to avoid calling code that have to checked by this test in check itself) ap[0].segments.should.equal(Path("g", "a", "d").segments); ap[1].segments.should.equal(Path("ab", "c", "d").segments); ap[2].segments.should.equal(Path("a", "d", "c").segments); ap[3].segments.should.equal(Path("a", "c", "e").segments); // Check simple comparisons Path("a", "d", "g").should.be.greater(Path("a", "b", "c")); Path("g", "d", "r").should.be.less(Path("m", "g", "x"));
Override comparison operators to use OS-specific case-sensitivity rules. They could be used for sorting of path array for example.