Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
carljm committed Oct 31, 2024
1 parent 0b59209 commit 706d0ad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/cycle/dataflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ fn cycle_diverges_then_converges() {
}

/// x = 0; y = 0; loop { x = y + 0; y = x + 0 }
#[test_log::test]
#[test]
fn multi_symbol_cycle_converges_then_diverges() {
let mut db = salsa::DatabaseImpl::new();

Expand Down
19 changes: 12 additions & 7 deletions tests/cycle/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,9 @@ fn nested_double_multiple_revisions() {
a.assert(&db, 240);
}

/// a:Ni(b) -> b:Np(a)
/// ^ |
/// +----------------+
/// a:Ni(b) -> b:Ni(c) -> c:Ni(a)
/// ^ |
/// +---------------------------+
///
/// In a cycle with some LOW durability and some HIGH durability inputs, changing a LOW durability
/// input still re-executes the full cycle in the next revision.
Expand All @@ -735,21 +735,26 @@ fn cycle_durability() {
let mut db = DbImpl::new();
let a_in = Inputs::new(&db, vec![]);
let b_in = Inputs::new(&db, vec![]);
let c_in = Inputs::new(&db, vec![]);
let a = Input::MinIterate(a_in);
let b = Input::MinIterate(b_in);
let c = Input::MinIterate(c_in);
a_in.set_inputs(&mut db)
.with_durability(Durability::LOW)
.to(vec![b]);
.to(vec![b.clone()]);
b_in.set_inputs(&mut db)
.with_durability(Durability::HIGH)
.to(vec![c]);
c_in.set_inputs(&mut db)
.with_durability(Durability::HIGH)
.to(vec![a.clone()]);

a.clone().assert(&db, 255);

// next revision, we hit max value instead
b_in.set_inputs(&mut db)
// next revision, we converge instead
a_in.set_inputs(&mut db)
.with_durability(Durability::LOW)
.to(vec![Input::Value(45), a.clone()]);
.to(vec![Input::Value(45), b]);

a.assert(&db, 45);
}

0 comments on commit 706d0ad

Please sign in to comment.