Early ISA Unit tests
Some checks failed
per-push tests / test-frontend (push) Blocked by required conditions
per-push tests / timed-decomposer-parse (push) Blocked by required conditions
per-push tests / test-utility (push) Blocked by required conditions
per-push tests / test-backend (push) Blocked by required conditions
per-push tests / build (push) Has been cancelled

This commit provides some but not all unit tests for VM instructions.
All tests pass, and this commit includes modifications to logic to allow
for that.

Signed-off-by: Ava Affine <ava@sunnypup.io>
This commit is contained in:
Ava Apples Affine 2025-07-30 00:01:07 +00:00
parent 609e65a8db
commit 3bc256dab2
6 changed files with 544 additions and 156 deletions

View file

@ -21,6 +21,7 @@ use core::ptr::NonNull;
use alloc::rc::Rc;
use alloc::vec::Vec;
use alloc::boxed::Box;
use alloc::fmt::Debug;
use alloc::string::String;
use organelle::Number;
@ -112,6 +113,15 @@ impl<T> Clone for Gc<T> {
}
}
impl<T: Debug> Debug for Gc<T> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let refs = Rc::strong_count(unsafe { self.0.as_ref() });
write!(f, "<refs={refs}>: ")?;
write!(f, "{:?}", (*(unsafe { self.0.as_ref() })).as_ref())?;
Ok(())
}
}
impl<T> Drop for Gc<T> {
fn drop(&mut self) {
unsafe {
@ -132,7 +142,7 @@ impl<T: Clone> Gc<T> {
}
}
#[derive(PartialEq)]
#[derive(PartialEq, Debug)]
pub enum Datum {
Number(Number),
Bool(bool),
@ -168,7 +178,7 @@ impl Clone for Datum {
}
}
#[derive(Clone, PartialEq)]
#[derive(Clone, PartialEq, Debug)]
pub struct Cons(pub Option<Gc<Datum>>, pub Option<Gc<Datum>>);
impl Cons {