diff options
| author | Christian Cunningham <c@localhost> | 2022-08-22 21:28:18 -0700 |
|---|---|---|
| committer | Christian Cunningham <c@localhost> | 2022-08-22 21:28:18 -0700 |
| commit | c238b2ea1dff60a5be6a796f44e533e89a346199 (patch) | |
| tree | 47a6a0009172d83bcd2e1be7df9dbd8aeb77ea50 /src/vga | |
| parent | 8c60628bd5db5c238d22fd3ce8b739824606a9de (diff) | |
Add serial suite
Diffstat (limited to 'src/vga')
| -rw-r--r-- | src/vga/.buffer.rs.swp | bin | 20480 -> 20480 bytes | |||
| -rw-r--r-- | src/vga/.mod.rs.swp | bin | 12288 -> 0 bytes | |||
| -rw-r--r-- | src/vga/buffer.rs | 34 |
3 files changed, 33 insertions, 1 deletions
diff --git a/src/vga/.buffer.rs.swp b/src/vga/.buffer.rs.swp Binary files differindex 0ce0feb..012b7b1 100644 --- a/src/vga/.buffer.rs.swp +++ b/src/vga/.buffer.rs.swp diff --git a/src/vga/.mod.rs.swp b/src/vga/.mod.rs.swp Binary files differdeleted file mode 100644 index 6071785..0000000 --- a/src/vga/.mod.rs.swp +++ /dev/null diff --git a/src/vga/buffer.rs b/src/vga/buffer.rs index 34c665d..4ca001c 100644 --- a/src/vga/buffer.rs +++ b/src/vga/buffer.rs @@ -109,6 +109,7 @@ impl NullLock<VgaWriter> { }); } + #[allow(dead_code)] pub fn write_string(&self, s: &str) { self.lock(|writer| { writer.write_string(s); @@ -152,6 +153,37 @@ macro_rules! println { pub static WRITER: NullLock<VgaWriter> = NullLock::new(VgaWriter { column_position: 0, - color_code: ColorCode::new(Color::Yellow, Color::Black), + color_code: ColorCode::new(Color::LightBlue, Color::Black), buffer: None, }); + +#[test_case] +fn test_println_simple() { + println!("test_println_simple output"); +} + +#[test_case] +fn test_println_many() { + for _ in 0..200 { + println!("test_println_many output"); + } +} + +#[test_case] +fn test_println_output() { + let s = "Some test string that fits on a single line"; + println!("{}", s); + for (i, c) in s.chars().enumerate() { + let screen_char = WRITER.lock(|writer| { + if let Some(buffer) = &writer.buffer { + return buffer.chars[BUFFER_HEIGHT - 2][i].read(); + } else { + return ScreenChar { + ascii_character: b' ', + color_code: ColorCode::new(Color::LightBlue, Color::Black), + }; + } + }); + assert_eq!(char::from(screen_char.ascii_character), c); + } +} |
