Files
RustIJVM/tests/advanced7.rs

67 lines
5.0 KiB
Rust

extern crate rustijvm;
use std::io::{SeekFrom, Seek, Read};
#[test]
#[ignore]
fn advanced7() {
let output = rustijvm::stubs::output_stub();
let mut machine = rustijvm::machine::Machine::new_from_file("files/advanced/mandelbread.ijvm").unwrap();
machine.set_output(output.clone());
machine.run().unwrap();
let expected = vec![
" ",
" ",
" ",
" t` ",
" `':``'t@ ",
" ``':L:`` ",
" `t:':C@@8t'`` ",
" `'f@@@@@@@@@@L` ",
" ``0@@@@@@@@@@@'` ",
" ::`'8'```''''':tf@@@@@@@C:'''`'`` `` ",
" `fG@@G@::f@@@@@@@@@@@@@@@@@@@G@8:'`L''':'` ",
" ``'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@f@@@@8:@ ",
" ``:::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@f` ",
" ``:8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@L`` ",
" 't`` `t`` ```'@L@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@:8`",
" `:tGt0:'':fG0:C'````''tC@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@G` ",
" ```:f@@@0@@@@@@@@Gt:::t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@t'' ",
" ```C:GC@@@@@@@@@@@@@@@@f8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@:' ",
" 'C''::t0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@f'` ",
" ` ```':L@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@f` ",
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@L:'` ",
" ` ```':L@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@f` ",
" 'C''::t0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@f'` ",
" ```C:GC@@@@@@@@@@@@@@@@f8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@:' ",
" ```:f@@@0@@@@@@@@Gt:::t@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@t'' ",
" `:tGt0:'':fG0:C'````''tC@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@G` ",
" 't`` `t`` ```'@L@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@:8`",
" ``:8@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@L`` ",
" ``:::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@f` ",
" ``'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@f@@@@8:@ ",
" `fG@@G@::f@@@@@@@@@@@@@@@@@@@G@8:'`L''':'` ",
" ::`'8'```''''':tf@@@@@@@C:'''`'`` `` ",
" ``0@@@@@@@@@@@'` ",
" `'f@@@@@@@@@@L` ",
" `t:':C@@8t'`` ",
" ``':L:`` ",
" `':``'t@ ",
" t` ",
" ",
" ",
];
let mut outbuf = output.lock().unwrap();
let mut actual = String::new();
outbuf.seek(SeekFrom::Start(0)).unwrap();
outbuf.read_to_string(&mut actual).unwrap();
for (line, (act, exp)) in actual.lines().zip(expected).enumerate() {
assert_eq!(act, exp, "mismatch on line {}", line + 1);
}
}