[geary/geary-0.13] Merge branch 'wip/259-arm64-test-failure' into 'master'



commit 8a80283ec53b9edd25d32ee2329e4ed080d97850
Author: Michael Gratton <mike vee net>
Date:   Sun Feb 24 04:46:54 2019 +0000

    Merge branch 'wip/259-arm64-test-failure' into 'master'
    
    Assert FolderPath comparisons properly in unit tests
    
    Closes #259
    
    See merge request GNOME/geary!136
    
    (cherry picked from commit b41ef0a5b7fcae680ad74e84c49a63c8f5658ae2)
    
    9c3fdbfb Assert FolderPath comparisons properly in unit tests

 test/engine/api/geary-folder-path-test.vala | 114 +++++++++++-----------------
 1 file changed, 46 insertions(+), 68 deletions(-)
---
diff --git a/test/engine/api/geary-folder-path-test.vala b/test/engine/api/geary-folder-path-test.vala
index eecfe81f..9f9a5f6f 100644
--- a/test/engine/api/geary-folder-path-test.vala
+++ b/test/engine/api/geary-folder-path-test.vala
@@ -162,62 +162,53 @@ public class Geary.FolderPathTest : TestCase {
         );
 
         // a is less than b
-        assert_int(
-            -1,
-            this.root.get_child("a").compare_to(this.root.get_child("b")),
+        assert_true(
+            this.root.get_child("a").compare_to(this.root.get_child("b")) < 0,
             "Greater than child comparison"
         );
 
         // b is greater than than a
-        assert_int(
-            1,
-            this.root.get_child("b").compare_to(this.root.get_child("a")),
+        assert_true(
+            this.root.get_child("b").compare_to(this.root.get_child("a")) > 0,
             "Less than child comparison"
         );
 
-        assert_int(
-            1,
+        assert_true(
             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"
         );
-        assert_int(
-            -1,
+        assert_true(
             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"
         );
 
-        assert_int(
-            0,
+        assert_true(
             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"
         );
 
-        assert_int(
-            -1,
+        assert_true(
             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"
         );
-        assert_int(
-            1,
+        assert_true(
             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"
         );
 
-        assert_int(
-            -1,
+        assert_true(
             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"
         );
-        assert_int(
-            1,
+        assert_true(
             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"
         );
 
@@ -231,42 +222,36 @@ public class Geary.FolderPathTest : TestCase {
         );
 
         // a is less than b
-        assert_int(
-            -1,
-            this.root.get_child("a").compare_normalized_ci(this.root.get_child("b")),
+        assert_true(
+            this.root.get_child("a").compare_normalized_ci(this.root.get_child("b")) < 0,
             "Greater than child comparison"
         );
 
         // b is greater than than a
-        assert_int(
-            1,
-            this.root.get_child("b").compare_normalized_ci(this.root.get_child("a")),
+        assert_true(
+            this.root.get_child("b").compare_normalized_ci(this.root.get_child("a")) > 0,
             "Less than child comparison"
         );
 
-        assert_int(
-            -1,
+        assert_true(
             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"
         );
-        assert_int(
-            1,
+        assert_true(
             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"
         );
 
-        assert_int(
-            1,
+        assert_true(
             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"
         );
-        assert_int(
-            -1,
+        assert_true(
             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"
         );
     }
@@ -279,50 +264,43 @@ public class Geary.FolderPathTest : TestCase {
         );
 
         // a is less than b
-        assert_int(
-            -1,
-            this.root.get_child("a").compare_to(new FolderRoot(false).get_child("b")),
+        assert_true(
+            this.root.get_child("a").compare_to(new FolderRoot(false).get_child("b")) < 0,
             "Greater than child comparison"
         );
 
         // b is greater than than a
-        assert_int(
-            1,
-            this.root.get_child("b").compare_to(new FolderRoot(false).get_child("a")),
+        assert_true(
+            this.root.get_child("b").compare_to(new FolderRoot(false).get_child("a")) > 0,
             "Less than child comparison"
         );
 
-        assert_int(
-            1,
+        assert_true(
             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"
         );
-        assert_int(
-            -1,
+        assert_true(
             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"
         );
 
-        assert_int(
-            0,
+        assert_true(
             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"
         );
 
-        assert_int(
-            -1,
+        assert_true(
             this.root.get_child("a").get_child("a")
-            .compare_to(new FolderRoot(false).get_child("b").get_child("b")),
-            "Greater than double disjoint"
+            .compare_to(new FolderRoot(false).get_child("b").get_child("b")) < 0,
+            "Less than double disjoint"
         );
-        assert_int(
-            1,
+        assert_true(
             this.root.get_child("b").get_child("a")
-            .compare_to(new FolderRoot(false).get_child("a").get_child("a")),
-            "Less than double disjoint"
+            .compare_to(new FolderRoot(false).get_child("a").get_child("a")) > 0,
+            "Greater than double disjoint"
         );
 
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]