Skip to content

Commit

Permalink
chore: fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludo Galabru committed Sep 30, 2022
1 parent 85dc79e commit 54d6da1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions components/clarity-repl/src/repl/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1259,38 +1259,38 @@ mod tests {

// assert data-var is set to 0
assert_eq!(
session.handle_command("(contract-call? .contract-2 get-x)")[0],
session.handle_command("(contract-call? .contract get-x)")[0],
green!("u0")
);

// advance chain tip and test at-block
session.advance_chain_tip(10000);
assert_eq!(
session.handle_command("(contract-call? .contract-2 get-x)")[0],
session.handle_command("(contract-call? .contract get-x)")[0],
green!("u0")
);
session.handle_command("(contract-call? .contract-2 incr)");
session.handle_command("(contract-call? .contract incr)");
assert_eq!(
session.handle_command("(contract-call? .contract-2 get-x)")[0],
session.handle_command("(contract-call? .contract get-x)")[0],
green!("u1")
);
assert_eq!(session.handle_command("(at-block (unwrap-panic (get-block-info? id-header-hash u0)) (contract-call? .contract-2 get-x))")[0], green!("u0"));
assert_eq!(session.handle_command("(at-block (unwrap-panic (get-block-info? id-header-hash u5000)) (contract-call? .contract-2 get-x))")[0], green!("u0"));
assert_eq!(session.handle_command("(at-block (unwrap-panic (get-block-info? id-header-hash u0)) (contract-call? .contract get-x))")[0], green!("u0"));
assert_eq!(session.handle_command("(at-block (unwrap-panic (get-block-info? id-header-hash u5000)) (contract-call? .contract get-x))")[0], green!("u0"));

// advance chain tip again and test at-block
// do this twice to make sure that the lookup table is being updated properly
session.advance_chain_tip(10);
session.advance_chain_tip(10);

assert_eq!(
session.handle_command("(contract-call? .contract-2 get-x)")[0],
session.handle_command("(contract-call? .contract get-x)")[0],
green!("u1")
);
session.handle_command("(contract-call? .contract-2 incr)");
session.handle_command("(contract-call? .contract incr)");
assert_eq!(
session.handle_command("(contract-call? .contract-2 get-x)")[0],
session.handle_command("(contract-call? .contract get-x)")[0],
green!("u2")
);
assert_eq!(session.handle_command("(at-block (unwrap-panic (get-block-info? id-header-hash u10000)) (contract-call? .contract-2 get-x))")[0], green!("u1"));
assert_eq!(session.handle_command("(at-block (unwrap-panic (get-block-info? id-header-hash u10000)) (contract-call? .contract get-x))")[0], green!("u1"));
}
}

0 comments on commit 54d6da1

Please sign in to comment.