Add more tests for println

This commit is contained in:
Greg Shuflin 2022-04-03 21:03:45 -07:00
parent cd685e79c7
commit 7cac67b0fc
1 changed files with 19 additions and 0 deletions

View File

@ -168,3 +168,22 @@ lazy_static! {
fn test_println_simple() {
println!("Does this work?");
}
#[test_case]
fn test_println_many() {
for _ in 0..200 {
println!("Test many output");
}
}
#[test_case]
fn test_println_output() {
let s = "Test string that fits on a single line";
println!("{}", s);
for (i, c) in s.chars().enumerate() {
let screen_char_ptr =
&WRITER.lock().buffer.chars[BUFFER_HEIGHT - 2][i] as *const ScreenChar;
let screen_char = unsafe { core::ptr::read_volatile(screen_char_ptr) };
assert_eq!(char::from(screen_char.ascii_char), c);
}
}