Update unit tests
This commit is contained in:
parent
bf3d40aa7e
commit
53e92f4573
2 changed files with 19 additions and 19 deletions
|
@ -12,7 +12,7 @@ use super::SnapshotMap;
|
|||
|
||||
#[test]
|
||||
fn basic() {
|
||||
let mut map = SnapshotMap::new();
|
||||
let mut map = SnapshotMap::default();
|
||||
map.insert(22, "twenty-two");
|
||||
let snapshot = map.snapshot();
|
||||
map.insert(22, "thirty-three");
|
||||
|
@ -29,7 +29,7 @@ fn basic() {
|
|||
#[test]
|
||||
#[should_panic]
|
||||
fn out_of_order() {
|
||||
let mut map = SnapshotMap::new();
|
||||
let mut map = SnapshotMap::default();
|
||||
map.insert(22, "twenty-two");
|
||||
let snapshot1 = map.snapshot();
|
||||
let _snapshot2 = map.snapshot();
|
||||
|
@ -38,7 +38,7 @@ fn out_of_order() {
|
|||
|
||||
#[test]
|
||||
fn nested_commit_then_rollback() {
|
||||
let mut map = SnapshotMap::new();
|
||||
let mut map = SnapshotMap::default();
|
||||
map.insert(22, "twenty-two");
|
||||
let snapshot1 = map.snapshot();
|
||||
let snapshot2 = map.snapshot();
|
||||
|
|
|
@ -489,7 +489,7 @@ impl<CTX> HashStable<CTX> for Index {
|
|||
|
||||
#[test]
|
||||
fn test_one_step() {
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("a", "b");
|
||||
relation.add("a", "c");
|
||||
assert!(relation.contains(&"a", &"c"));
|
||||
|
@ -500,7 +500,7 @@ fn test_one_step() {
|
|||
|
||||
#[test]
|
||||
fn test_many_steps() {
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("a", "b");
|
||||
relation.add("a", "c");
|
||||
relation.add("a", "f");
|
||||
|
@ -530,7 +530,7 @@ fn mubs_triangle() {
|
|||
// ^
|
||||
// |
|
||||
// b
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("a", "tcx");
|
||||
relation.add("b", "tcx");
|
||||
assert_eq!(relation.minimal_upper_bounds(&"a", &"b"), vec![&"tcx"]);
|
||||
|
@ -551,7 +551,7 @@ fn mubs_best_choice1() {
|
|||
// need the second pare down call to get the right result (after
|
||||
// intersection, we have [1, 2], but 2 -> 1).
|
||||
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("0", "1");
|
||||
relation.add("0", "2");
|
||||
|
||||
|
@ -578,7 +578,7 @@ fn mubs_best_choice2() {
|
|||
// Like the precedecing test, but in this case intersection is [2,
|
||||
// 1], and hence we rely on the first pare down call.
|
||||
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("0", "1");
|
||||
relation.add("0", "2");
|
||||
|
||||
|
@ -597,7 +597,7 @@ fn mubs_best_choice2() {
|
|||
fn mubs_no_best_choice() {
|
||||
// in this case, the intersection yields [1, 2], and the "pare
|
||||
// down" calls find nothing to remove.
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("0", "1");
|
||||
relation.add("0", "2");
|
||||
|
||||
|
@ -614,7 +614,7 @@ fn mubs_best_choice_scc() {
|
|||
// in this case, 1 and 2 form a cycle; we pick arbitrarily (but
|
||||
// consistently).
|
||||
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("0", "1");
|
||||
relation.add("0", "2");
|
||||
|
||||
|
@ -636,7 +636,7 @@ fn pdub_crisscross() {
|
|||
// /\ |
|
||||
// b -> b1 ---+
|
||||
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("a", "a1");
|
||||
relation.add("a", "b1");
|
||||
relation.add("b", "a1");
|
||||
|
@ -659,7 +659,7 @@ fn pdub_crisscross_more() {
|
|||
// /\ /\ |
|
||||
// b -> b1 -> b2 ---------+
|
||||
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("a", "a1");
|
||||
relation.add("a", "b1");
|
||||
relation.add("b", "a1");
|
||||
|
@ -692,7 +692,7 @@ fn pdub_lub() {
|
|||
// |
|
||||
// b -> b1 ---+
|
||||
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("a", "a1");
|
||||
relation.add("b", "b1");
|
||||
relation.add("a1", "x");
|
||||
|
@ -715,7 +715,7 @@ fn mubs_intermediate_node_on_one_side_only() {
|
|||
// b
|
||||
|
||||
// "digraph { a -> c -> d; b -> d; }",
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("a", "c");
|
||||
relation.add("c", "d");
|
||||
relation.add("b", "d");
|
||||
|
@ -734,7 +734,7 @@ fn mubs_scc_1() {
|
|||
// b
|
||||
|
||||
// "digraph { a -> c -> d; d -> c; a -> d; b -> d; }",
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("a", "c");
|
||||
relation.add("c", "d");
|
||||
relation.add("d", "c");
|
||||
|
@ -754,7 +754,7 @@ fn mubs_scc_2() {
|
|||
// +--- b
|
||||
|
||||
// "digraph { a -> c -> d; d -> c; b -> d; b -> c; }",
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("a", "c");
|
||||
relation.add("c", "d");
|
||||
relation.add("d", "c");
|
||||
|
@ -774,7 +774,7 @@ fn mubs_scc_3() {
|
|||
// b ---+
|
||||
|
||||
// "digraph { a -> c -> d -> e -> c; b -> d; b -> e; }",
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("a", "c");
|
||||
relation.add("c", "d");
|
||||
relation.add("d", "e");
|
||||
|
@ -796,7 +796,7 @@ fn mubs_scc_4() {
|
|||
// b ---+
|
||||
|
||||
// "digraph { a -> c -> d -> e -> c; a -> d; b -> e; }"
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
relation.add("a", "c");
|
||||
relation.add("c", "d");
|
||||
relation.add("d", "e");
|
||||
|
@ -834,7 +834,7 @@ fn parent() {
|
|||
(1, /*->*/ 3),
|
||||
];
|
||||
|
||||
let mut relation = TransitiveRelation::new();
|
||||
let mut relation = TransitiveRelation::default();
|
||||
for (a, b) in pairs {
|
||||
relation.add(a, b);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue