Progress checker works

This commit is contained in:
quexeky
2024-10-18 20:42:26 +11:00
parent 496c6a57e3
commit 7fec00ded0
6 changed files with 98 additions and 11 deletions

View File

@ -0,0 +1,17 @@
use crate::downloads::progress::ProgressChecker;
#[test]
fn test_progress_sequentially() {
let p = ProgressChecker::new(Box::new(test_fn));
p.run_contexts_sequentially((1..100).collect());
println!("Progress: {}", p.get_progress_percentage(100));
}
#[test]
fn test_progress_parallel() {
let p = ProgressChecker::new(Box::new(test_fn));
p.run_contexts_parallel((1..100).collect(), 10);
}
fn test_fn(int: usize) {
println!("{}", int);
}