mirror of
https://github.com/rust-lang/cargo
synced 2024-10-14 03:32:39 +00:00
make sure cashing works whether there is an answer or not
This commit is contained in:
parent
8bd7286bfd
commit
61e78c10f1
|
@ -470,13 +470,15 @@ fn resolving_with_constrained_sibling_backtrack_parent() {
|
|||
|
||||
#[test]
|
||||
fn resolving_with_many_equivalent_backtracking() {
|
||||
let mut reglist = vec![
|
||||
pkg!(("level0", "1.0.0")),
|
||||
];
|
||||
let mut reglist = Vec::new();
|
||||
|
||||
const DEPTH: usize = 200;
|
||||
const BRANCHING_FACTOR: usize = 100;
|
||||
|
||||
// Each level depends on the next but the last level does not exist.
|
||||
// Without cashing we need to test every path to the last level O(BRANCHING_FACTOR ^ DEPTH)
|
||||
// and this test will time out. With cashing we need to discover that none of these
|
||||
// can be activated O(BRANCHING_FACTOR * DEPTH)
|
||||
for l in 0..DEPTH {
|
||||
let name = format!("level{}", l);
|
||||
let next = format!("level{}", l + 1);
|
||||
|
@ -486,6 +488,18 @@ fn resolving_with_many_equivalent_backtracking() {
|
|||
}
|
||||
}
|
||||
|
||||
let reg = registry(reglist.clone());
|
||||
|
||||
let res = resolve(&pkg_id("root"), vec![
|
||||
dep_req("level0", "*"),
|
||||
], ®);
|
||||
|
||||
assert!(res.is_err());
|
||||
|
||||
// It is easy to write code that quickly returns an error.
|
||||
// Lets make sure we can find a good answer if it is there.
|
||||
reglist.push(pkg!(("level0", "1.0.0")));
|
||||
|
||||
let reg = registry(reglist);
|
||||
|
||||
let res = resolve(&pkg_id("root"), vec![
|
||||
|
|
Loading…
Reference in a new issue