Skip to content

Commit

Permalink
Split off slow tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdrozd committed Jun 12, 2024
1 parent 0dc51ac commit 3ac63d3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ test-rust :
cargo --version
cargo test

test-rust-all :
cargo --version
cargo test -- --include-ignored

clean-rust :
cargo clean

Expand Down Expand Up @@ -86,7 +90,7 @@ PYTEST = $(PYTHON) -m unittest
test : test-rust
$(PYTEST) discover -v

test-all : test-rust compile
test-all : test-rust-all compile
RUN_SLOW=1 $(MAKE) test

tree : compile
Expand Down
31 changes: 23 additions & 8 deletions src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ pub fn tree_progs(
progs
}

#[cfg(test)]
fn assert_tree(params: Params, halt: u8, leaves: u64) {
let mut leaf_count = 0;

build_tree(params, halt != 0, 100, &mut |_| {
leaf_count += 1;
});

assert_eq!(leaf_count, leaves);
}

#[test]
fn test_tree() {
let leaves = vec![
Expand All @@ -191,20 +202,24 @@ fn test_tree() {
//
((2, 4), 1, 312_627),
((2, 4), 0, 1_718_772),
//
];

for (params, halt, leaves) in leaves {
assert_tree(params, halt, leaves);
}
}

#[test]
#[ignore]
fn test_tree_slow() {
let leaves = vec![
((5, 2), 1, 95_309_237),
//
((2, 5), 1, 70_004_752),
];

for (params, halt, leaves) in leaves {
let mut leaf_count = 0;

build_tree(params, halt != 0, 100, &mut |_| {
leaf_count += 1;
});

assert_eq!(leaf_count, leaves);
assert_tree(params, halt, leaves);
}
}

Expand Down

0 comments on commit 3ac63d3

Please sign in to comment.