Files
k-os/crates/domain/src/message/tests.rs
Gabriel Kaszewski 76f10ff1f1 feat(kernel): seL4-style IPC, notifications, status ABI
- badges + Mint, Call/Reply/ReplyRecv w/ gen-checked reply slot
- cap transfer (1/msg, copy, needs Delegate, rechecked at delivery)
- notifications: signal/wait/poll/bind, irq -> notification routing
- WaitAny/WaitForInterrupt removed; a0=status, ErrorCode
- libkos: single ecall primitive, compat wrappers + typed new api
- fix: trap return clobbered user t0 on every trap
- fix: wait queues FIFO, delegate keeps badge, fault cap checked
- docs/ipc.md spec, ipc tests, ipc fuzz, kani ntfn + waitqueue
2026-10-26 20:27:38 +01:00

24 lines
615 B
Rust

use super::*;
use types::bounded::CapSlot;
#[test]
fn empty_message_has_zeroed_words_and_no_cap() {
let msg = Message::empty();
assert_eq!(msg.words(), &[0; MAX_MESSAGE_WORDS]);
assert!(msg.cap().is_none());
}
#[test]
fn from_words_keeps_every_word() {
let msg = Message::from_words([10, 20, 30, 40]);
assert_eq!(msg.words(), &[10, 20, 30, 40]);
assert!(msg.cap().is_none());
}
#[test]
fn with_cap_attaches_one_capability() {
let msg = Message::from_words([1, 2, 3, 4]).with_cap(CapSlot::new(5).unwrap());
assert_eq!(msg.cap(), CapSlot::new(5));
assert_eq!(msg.word(3), 4);
}