Test harness for HyphaeVM
All checks were successful
per-push tests / build (push) Successful in 49s
per-push tests / test-frontend (push) Successful in 53s
per-push tests / test-utility (push) Successful in 1m2s
per-push tests / test-backend (push) Successful in 54s
per-push tests / timed-decomposer-parse (push) Successful in 56s
All checks were successful
per-push tests / build (push) Successful in 49s
per-push tests / test-frontend (push) Successful in 53s
per-push tests / test-utility (push) Successful in 1m2s
per-push tests / test-backend (push) Successful in 54s
per-push tests / timed-decomposer-parse (push) Successful in 56s
This commit adds a testing framework for HyphaeVM which enables testing various aspects of the VM state after running input programs against a VM with possibly preinitialized state. This includes a builder pattern initializer for the VM, and bespoke logic for a test case tester. Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
parent
ddb49788af
commit
609e65a8db
4 changed files with 312 additions and 3 deletions
|
|
@ -20,6 +20,7 @@ struct Instruction {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let mut peak = 0;
|
||||
let output_path = Path::new(&env::var("OUT_DIR").unwrap())
|
||||
.join("hyphae_instr.rs");
|
||||
let input = fs::read_to_string("instructions.toml")
|
||||
|
|
@ -73,7 +74,9 @@ fn main() {
|
|||
const_name, const_name).as_str();
|
||||
|
||||
isa_num_args += format!(" {} => Ok({}),\n", idx, instr.args.len())
|
||||
.as_str()
|
||||
.as_str();
|
||||
|
||||
peak = idx + 1;
|
||||
});
|
||||
|
||||
isa_from_byte += " _ => Err(\"illegal instruction\"),\n";
|
||||
|
|
@ -104,6 +107,8 @@ fn main() {
|
|||
|
||||
write!(&mut output_file, "use core::str::FromStr;\n\n\n").unwrap();
|
||||
write!(&mut output_file, "{}", isa).unwrap();
|
||||
write!(&mut output_file, "\n\npub const TOTAL_INSTRUCTIONS: usize = {};", peak)
|
||||
.unwrap();
|
||||
println!("cargo::rerun-if-changed=build.rs");
|
||||
println!("cargo::rerun-if-changed=instructions.json");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue