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

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:
Ava Apples Affine 2025-07-29 23:29:34 +00:00
parent ddb49788af
commit 609e65a8db
4 changed files with 312 additions and 3 deletions

View file

@ -24,16 +24,63 @@ struct StackInner<T: Sized> {
pub data: T
}
impl<T: Clone> Clone for StackInner<T> {
fn clone(&self) -> Self {
StackInner{
next: self.next.clone(),
data: self.data.clone()
}
}
fn clone_from(&mut self, source: &Self) {
*self = source.clone()
}
}
struct Stack<T: Sized> (Rc<Option<StackInner<T>>>);
impl<T: Clone> Clone for Stack<T> {
fn clone(&self) -> Self {
Stack(Rc::from((*self.0).clone()))
}
fn clone_from(&mut self, source: &Self) {
*self = source.clone()
}
}
struct StackStackInner<T: Sized> {
next: StackStack<T>,
count: usize,
stack: Stack<T>,
}
impl<T: Clone> Clone for StackStackInner<T> {
fn clone(&self) -> Self {
StackStackInner{
next: self.next.clone(),
count: self.count,
stack: self.stack.clone()
}
}
fn clone_from(&mut self, source: &Self) {
*self = source.clone()
}
}
pub struct StackStack<T: Sized> (Rc<Option<StackStackInner<T>>>);
impl<T: Clone> Clone for StackStack<T> {
fn clone(&self) -> Self {
StackStack(Rc::from((*self.0).clone()))
}
fn clone_from(&mut self, source: &Self) {
*self = source.clone()
}
}
impl<T> From<T> for StackInner<T> {
fn from(t: T) -> StackInner<T> {
StackInner {