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
48
49
50
51
|
use crate::io::{qemu, serial, vga_text};
use core::fmt::Write;
use qemu::{exit_qemu, QemuExitCode};
use serial::SerialStream;
use vga_text::OStream;
#[cfg(test)]
pub fn serial_test_runner_panic(tests: &[&dyn Fn()]) {
let mut stdout = SerialStream::new();
write!(stdout, "Running {} tests", tests.len()).unwrap();
for test in tests {
test();
write!(stdout, "[test did not panic]").unwrap();
exit_qemu(QemuExitCode::Failed);
}
exit_qemu(QemuExitCode::Success);
}
#[cfg(test)]
pub fn serial_test_runner(tests: &[&dyn Fn()]) {
let mut stdout = SerialStream::new();
write!(stdout, "Running {} tests", tests.len()).unwrap();
for test in tests {
test();
write!(stdout, "[test did not panic]").unwrap();
}
exit_qemu(QemuExitCode::Success);
}
#[cfg(test)]
pub fn test_runner_panic(tests: &[&dyn Fn()]) {
let mut stdout = OStream::new();
write!(stdout, "Running {} tests", tests.len()).unwrap();
for test in tests {
test();
write!(stdout, "[test did not panic]").unwrap();
exit_qemu(QemuExitCode::Failed);
}
exit_qemu(QemuExitCode::Success);
}
#[cfg(test)]
pub fn test_runner(tests: &[&dyn Fn()]) {
let mut stdout = OStream::new();
write!(stdout, "Running {} tests", tests.len()).unwrap();
for test in tests {
test();
write!(stdout, "[test did not panic]").unwrap();
}
exit_qemu(QemuExitCode::Success);
}
|