diff --git a/src/vga_buffer.rs b/src/vga_buffer.rs index f64180b..b88aad9 100644 --- a/src/vga_buffer.rs +++ b/src/vga_buffer.rs @@ -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); + } +}