1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
use crate::io::{qemu, serial, vga_text};
use core::fmt::Write;
use qemu::{exit_qemu, QemuExitCode};
use serial::SerialStream;
use vga_text::OStream;
pub fn serial_test_runner_panic(tests: &[&dyn Fn()]) {
let mut stdout = SerialStream::new();
write!(stdout, "\nRunning {} tests\n", tests.len()).unwrap();
for test in tests {
test();
write!(stdout, "\n[test did not panic]\n\n").unwrap();
exit_qemu(QemuExitCode::Failed);
}
exit_qemu(QemuExitCode::Success);
}
pub fn serial_test_runner(tests: &[&dyn Fn()]) {
let mut stdout = SerialStream::new();
write!(stdout, "\nRunning {} tests\n", tests.len()).unwrap();
for test in tests {
test();
write!(stdout, "\n[OK]\n").unwrap();
}
exit_qemu(QemuExitCode::Success);
}
pub fn test_runner_panic(tests: &[&dyn Fn()]) {
let mut stdout = OStream::new();
write!(stdout, "\nRunning {} tests\n", tests.len()).unwrap();
for test in tests {
test();
write!(stdout, "\n[test did not panic]\n\n").unwrap();
exit_qemu(QemuExitCode::Failed);
}
exit_qemu(QemuExitCode::Success);
}
pub fn test_runner(tests: &[&dyn Fn()]) {
let mut stdout = OStream::new();
write!(stdout, "\nRunning {} tests\n", tests.len()).unwrap();
for test in tests {
test();
write!(stdout, "\n[OK]\n").unwrap();
}
exit_qemu(QemuExitCode::Success);
}
|