about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2015-08-21 10:58:32 -0400
committerNiko Matsakis <niko@alum.mit.edu>2015-08-21 10:58:32 -0400
commitaa469a994cced0db89fc889322430d41fa6f40eb (patch)
tree2d3043485cdb19e2d05d4665f908d8fd2d5f27c1 /src/librustc_data_structures
parent2a25876c585ede337fc4167147bbbfa53d30ca2b (diff)
downloadrust-aa469a994cced0db89fc889322430d41fa6f40eb.tar.gz
rust-aa469a994cced0db89fc889322430d41fa6f40eb.zip
add final test case, correct one of the others (both versions produced
same result)
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/transitive_relation.rs26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/librustc_data_structures/transitive_relation.rs b/src/librustc_data_structures/transitive_relation.rs
index 738e516f22e..abd9b0a331e 100644
--- a/src/librustc_data_structures/transitive_relation.rs
+++ b/src/librustc_data_structures/transitive_relation.rs
@@ -535,7 +535,7 @@ fn mubs_scc_3() {
     let mut relation = TransitiveRelation::new();
     relation.add("a",  "c");
     relation.add("c",  "d");
-    relation.add("e",  "e");
+    relation.add("d",  "e");
     relation.add("e",  "c");
     relation.add("b",  "d");
     relation.add("b",  "e");
@@ -543,6 +543,24 @@ fn mubs_scc_3() {
     assert_eq!(relation.minimal_upper_bounds(&"a", &"b"), vec![&"c"]);
 }
 
-/*
-    "digraph { a -> c -> d -> e -> c; a -> d; b -> e; }"
-*/
+#[test]
+fn mubs_scc_4() {
+    //      +---------+
+    //      v         |
+    // a -> c -> d -> e
+    // |         ^    ^
+    // +---------+    |
+    //                |
+    //           b ---+
+
+    // "digraph { a -> c -> d -> e -> c; a -> d; b -> e; }"
+    let mut relation = TransitiveRelation::new();
+    relation.add("a",  "c");
+    relation.add("c",  "d");
+    relation.add("d",  "e");
+    relation.add("e",  "c");
+    relation.add("a",  "d");
+    relation.add("b",  "e");
+
+    assert_eq!(relation.minimal_upper_bounds(&"a", &"b"), vec![&"c"]);
+}