Update on GameDownload

This commit is contained in:
quexeky
2024-10-18 22:35:03 +11:00
parent 7fec00ded0
commit e71e4cf0fa
6 changed files with 80 additions and 7 deletions

View File

@ -1,14 +1,18 @@
use std::sync::Arc;
use std::sync::atomic::AtomicUsize;
use crate::downloads::progress::ProgressChecker;
#[test]
fn test_progress_sequentially() {
let p = ProgressChecker::new(Box::new(test_fn));
let counter = Arc::new(AtomicUsize::new(0));
let p = ProgressChecker::new(Box::new(test_fn), counter.clone());
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));
let counter = Arc::new(AtomicUsize::new(0));
let p = ProgressChecker::new(Box::new(test_fn), counter.clone());
p.run_contexts_parallel((1..100).collect(), 10);
}