Add dummy functoin that does a simple addition to verify that unit tests are working

Signed-off-by: Noah Knegt <git@noahknegt.com>
This commit is contained in:
2025-07-22 20:12:45 +02:00
parent a91d52890a
commit cd817d2013

View File

@@ -21,6 +21,7 @@ pub fn main(boot_info: &'static mut BootInfo) -> ! {
logger::init_logger(buffer, info); logger::init_logger(buffer, info);
log::info!("Hello World from KERNEL"); log::info!("Hello World from KERNEL");
log::debug!("ADDING 1 & 6, result == {}", add(1, 6));
// Endless loop as the kernel must stay running // Endless loop as the kernel must stay running
loop {} loop {}
@@ -33,3 +34,12 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
log::error!("{}", info); log::error!("{}", info);
loop {} loop {}
} }
fn add(a: i32, b: i32) -> i32 {
a + b
}
#[test]
fn add_test() {
assert_eq!(add(1, 2), 3);
}