Show duration for long-running Rust tests
This roughly matches Tasty's behaviour.
This commit is contained in:
parent
4dc49febe4
commit
4c05c068fa
@ -6,6 +6,7 @@ use puzzles::day2;
|
|||||||
use puzzles::day3;
|
use puzzles::day3;
|
||||||
use puzzles::day4;
|
use puzzles::day4;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
const PUZZLES: [&dyn SomePuzzle; 4] = [&day1::PUZZLE, &day2::PUZZLE, &day3::PUZZLE, &day4::PUZZLE];
|
const PUZZLES: [&dyn SomePuzzle; 4] = [&day1::PUZZLE, &day2::PUZZLE, &day3::PUZZLE, &day4::PUZZLE];
|
||||||
|
|
||||||
@ -22,9 +23,15 @@ fn main() {
|
|||||||
fs::read_to_string(format!("../outputs/{}/{}/{}", t, puzzle.number(), n))
|
fs::read_to_string(format!("../outputs/{}/{}/{}", t, puzzle.number(), n))
|
||||||
.expect("no golden file");
|
.expect("no golden file");
|
||||||
print!(" {}: ", n);
|
print!(" {}: ", n);
|
||||||
|
let start = Instant::now();
|
||||||
let output = run();
|
let output = run();
|
||||||
|
let elapsed = start.elapsed();
|
||||||
if expected == output {
|
if expected == output {
|
||||||
println!("OK");
|
print!("OK");
|
||||||
|
if elapsed > Duration::from_millis(10) {
|
||||||
|
print!(" ({:?}) ", elapsed);
|
||||||
|
}
|
||||||
|
print!("\n");
|
||||||
} else {
|
} else {
|
||||||
println!(
|
println!(
|
||||||
"expected {}, got {}",
|
"expected {}, got {}",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user