checkpoint in reconstruction
This commit is contained in:
17
build.rs
17
build.rs
@@ -72,13 +72,28 @@ fn generate_tests(f: &mut File, path_so_far: PathBuf) -> std::io::Result<()> {
|
||||
f,
|
||||
" assert_eq!(errors.len(), 0, \"file should have no validation errors\");"
|
||||
)?;
|
||||
writeln!(f, " let syntax_result = syntax.eval();")?;
|
||||
writeln!(
|
||||
f,
|
||||
" let ir = syntax.type_infer().expect(\"example is typed correctly\");"
|
||||
)?;
|
||||
writeln!(f, " let ir_result = ir.eval();")?;
|
||||
writeln!(f, " match (&syntax_result, &ir_result) {{")?;
|
||||
writeln!(f, " (Err(e1), Err(e2)) => assert_eq!(e1, e2),")?;
|
||||
writeln!(f, " (Ok((v1, o1)), Ok((v2, o2))) => {{")?;
|
||||
writeln!(f, " assert_eq!(v1, v2);")?;
|
||||
writeln!(f, " assert_eq!(o1, o2);")?;
|
||||
writeln!(f, " }}")?;
|
||||
writeln!(f, " _ => panic!(\"mismatched outputs, {{:?}} and {{:?}}\", syntax_result, ir_result)")?;
|
||||
writeln!(f, " }}")?;
|
||||
writeln!(f, " let compiled_result = Backend::<JITModule>::eval(ir);")?;
|
||||
writeln!(f, " assert_eq!(ir_result, compiled_result);")?;
|
||||
writeln!(f, " match (&compiled_result, &ir_result) {{")?;
|
||||
writeln!(f, " (Err(e1), Err(e2)) => assert_eq!(e1, e2),")?;
|
||||
writeln!(f, " (Ok(o1), Ok((_, o2))) => {{")?;
|
||||
writeln!(f, " assert_eq!(o1, o2);")?;
|
||||
writeln!(f, " }}")?;
|
||||
writeln!(f, " _ => panic!(\"mismatched outputs, {{:?}} and {{:?}}\", compiled_result, ir_result)")?;
|
||||
writeln!(f, " }}")?;
|
||||
}
|
||||
writeln!(f, "}}")?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user