#![no_std]
#![cfg_attr(test, no_main)]
#![feature(custom_test_frameworks)]
#![test_runner(crate::test_runner)]
#![reexport_test_harness_main = "test_main"]
#[allow(missing_docs)]
pub trait Testable
{
fn run(&self) -> ();
}
impl<T> Testable for T
where
T: Fn(),
{
fn run(&self)
{
mango_core::print!("{}...\t", core::any::type_name::<T>());
self();
mango_core::println!("[ok]");
}
}
#[allow(missing_docs)]
pub fn test_runner(tests: &[&dyn Testable])
{
mango_core::println!("Running {} tests", tests.len());
for test in tests
{
test.run();
}
#[cfg(feature = "qemu")]
mango_core::qemu::exit_qemu(mango_core::qemu::QemuExitCode::Success);
}