unit testing for vga
This commit is contained in:
parent
e009cd22a8
commit
386522208e
1 changed files with 25 additions and 0 deletions
|
@ -155,3 +155,28 @@ impl Writer {
|
|||
}
|
||||
}
|
||||
|
||||
#[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 = "loss and gain is the same";
|
||||
println!("{}", s);
|
||||
|
||||
for (i, c) in s.chars().enumerate() {
|
||||
let screen_char = WRITER.lock()
|
||||
.buffer
|
||||
.chars[BUFFER_HEIGHT - 2][i]
|
||||
.read();
|
||||
assert_eq!(char::from(screen_char.ascii_carachter), c);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue