Merge branch 'wip/259-arm64-test-failure' into 'master'

Assert FolderPath comparisons properly in unit tests

Closes #259

See merge request GNOME/geary!136
This commit is contained in:
Michael Gratton 2019-02-24 04:46:54 +00:00
commit b41ef0a5b7

View file

@ -162,62 +162,53 @@ public class Geary.FolderPathTest : TestCase {
); );
// a is less than b // a is less than b
assert_int( assert_true(
-1, this.root.get_child("a").compare_to(this.root.get_child("b")) < 0,
this.root.get_child("a").compare_to(this.root.get_child("b")),
"Greater than child comparison" "Greater than child comparison"
); );
// b is greater than than a // b is greater than than a
assert_int( assert_true(
1, this.root.get_child("b").compare_to(this.root.get_child("a")) > 0,
this.root.get_child("b").compare_to(this.root.get_child("a")),
"Less than child comparison" "Less than child comparison"
); );
assert_int( assert_true(
1,
this.root.get_child("a").get_child("test") this.root.get_child("a").get_child("test")
.compare_to(this.root.get_child("a")), .compare_to(this.root.get_child("a")) > 0,
"Greater than descendant" "Greater than descendant"
); );
assert_int( assert_true(
-1,
this.root.get_child("a") this.root.get_child("a")
.compare_to(this.root.get_child("a").get_child("test")), .compare_to(this.root.get_child("a").get_child("test")) < 0,
"Less than descendant" "Less than descendant"
); );
assert_int( assert_true(
0,
this.root.get_child("a").get_child("b") this.root.get_child("a").get_child("b")
.compare_to(this.root.get_child("a").get_child("b")), .compare_to(this.root.get_child("a").get_child("b")) == 0,
"N-path equality" "N-path equality"
); );
assert_int( assert_true(
-1,
this.root.get_child("a").get_child("test") this.root.get_child("a").get_child("test")
.compare_to(this.root.get_child("b").get_child("test")), .compare_to(this.root.get_child("b").get_child("test")) < 0,
"Greater than disjoint paths" "Greater than disjoint paths"
); );
assert_int( assert_true(
1,
this.root.get_child("b").get_child("test") this.root.get_child("b").get_child("test")
.compare_to(this.root.get_child("a").get_child("test")), .compare_to(this.root.get_child("a").get_child("test")) > 0,
"Less than disjoint paths" "Less than disjoint paths"
); );
assert_int( assert_true(
-1,
this.root.get_child("a").get_child("d") this.root.get_child("a").get_child("d")
.compare_to(this.root.get_child("b").get_child("c")), .compare_to(this.root.get_child("b").get_child("c")) < 0,
"Greater than double disjoint" "Greater than double disjoint"
); );
assert_int( assert_true(
1,
this.root.get_child("b").get_child("c") this.root.get_child("b").get_child("c")
.compare_to(this.root.get_child("a").get_child("d")), .compare_to(this.root.get_child("a").get_child("d")) > 0,
"Less than double disjoint" "Less than double disjoint"
); );
@ -231,42 +222,36 @@ public class Geary.FolderPathTest : TestCase {
); );
// a is less than b // a is less than b
assert_int( assert_true(
-1, this.root.get_child("a").compare_normalized_ci(this.root.get_child("b")) < 0,
this.root.get_child("a").compare_normalized_ci(this.root.get_child("b")),
"Greater than child comparison" "Greater than child comparison"
); );
// b is greater than than a // b is greater than than a
assert_int( assert_true(
1, this.root.get_child("b").compare_normalized_ci(this.root.get_child("a")) > 0,
this.root.get_child("b").compare_normalized_ci(this.root.get_child("a")),
"Less than child comparison" "Less than child comparison"
); );
assert_int( assert_true(
-1,
this.root.get_child("a").get_child("test") this.root.get_child("a").get_child("test")
.compare_normalized_ci(this.root.get_child("b").get_child("test")), .compare_normalized_ci(this.root.get_child("b").get_child("test")) < 0,
"Greater than disjoint parents" "Greater than disjoint parents"
); );
assert_int( assert_true(
1,
this.root.get_child("b").get_child("test") this.root.get_child("b").get_child("test")
.compare_normalized_ci(this.root.get_child("a").get_child("test")), .compare_normalized_ci(this.root.get_child("a").get_child("test")) > 0,
"Less than disjoint parents" "Less than disjoint parents"
); );
assert_int( assert_true(
1,
this.root.get_child("a").get_child("test") this.root.get_child("a").get_child("test")
.compare_normalized_ci(this.root.get_child("a")), .compare_normalized_ci(this.root.get_child("a")) > 0,
"Greater than descendant" "Greater than descendant"
); );
assert_int( assert_true(
-1,
this.root.get_child("a") this.root.get_child("a")
.compare_normalized_ci(this.root.get_child("a").get_child("test")), .compare_normalized_ci(this.root.get_child("a").get_child("test")) < 0,
"Less than descendant" "Less than descendant"
); );
} }
@ -279,51 +264,44 @@ public class Geary.FolderPathTest : TestCase {
); );
// a is less than b // a is less than b
assert_int( assert_true(
-1, this.root.get_child("a").compare_to(new FolderRoot(false).get_child("b")) < 0,
this.root.get_child("a").compare_to(new FolderRoot(false).get_child("b")),
"Greater than child comparison" "Greater than child comparison"
); );
// b is greater than than a // b is greater than than a
assert_int( assert_true(
1, this.root.get_child("b").compare_to(new FolderRoot(false).get_child("a")) > 0,
this.root.get_child("b").compare_to(new FolderRoot(false).get_child("a")),
"Less than child comparison" "Less than child comparison"
); );
assert_int( assert_true(
1,
this.root.get_child("a").get_child("test") this.root.get_child("a").get_child("test")
.compare_to(new FolderRoot(false).get_child("a")), .compare_to(new FolderRoot(false).get_child("a")) > 0,
"Greater than descendant" "Greater than descendant"
); );
assert_int( assert_true(
-1,
this.root.get_child("a") this.root.get_child("a")
.compare_to(new FolderRoot(false).get_child("a").get_child("test")), .compare_to(new FolderRoot(false).get_child("a").get_child("test")) < 0,
"Less than descendant" "Less than descendant"
); );
assert_int( assert_true(
0,
this.root.get_child("a").get_child("b") this.root.get_child("a").get_child("b")
.compare_to(new FolderRoot(false).get_child("a").get_child("b")), .compare_to(new FolderRoot(false).get_child("a").get_child("b")) == 0,
"N-path equality" "N-path equality"
); );
assert_int( assert_true(
-1,
this.root.get_child("a").get_child("a") this.root.get_child("a").get_child("a")
.compare_to(new FolderRoot(false).get_child("b").get_child("b")), .compare_to(new FolderRoot(false).get_child("b").get_child("b")) < 0,
"Greater than double disjoint"
);
assert_int(
1,
this.root.get_child("b").get_child("a")
.compare_to(new FolderRoot(false).get_child("a").get_child("a")),
"Less than double disjoint" "Less than double disjoint"
); );
assert_true(
this.root.get_child("b").get_child("a")
.compare_to(new FolderRoot(false).get_child("a").get_child("a")) > 0,
"Greater than double disjoint"
);
} }