MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / kernel_boot_kmalloc_works

Function kernel_boot_kmalloc_works

tests/integration/platform_stdlib.rs:635–655  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

633main: () -> i32 {
634 s: OwnedString = { .bytes = { .ptr = null, .len = 0, .capacity = 0 } }
635 OwnedString_init(&s)
636
637 seeded := OwnedString_from_slice(&s, "hi")
638 match seeded {
639 Ok(len) -> { if len != 2 { return 1 } }
640 Err(error) -> { return 2 }
641 }
642 appended := OwnedString_append(&s, " there")
643 match appended {
644 Ok(len) -> { if len != 8 { return 3 } }
645 Err(error) -> { return 4 }
646 }
647
648 view: u8[] = OwnedString_as_slice(&s)
649 if view.len != 8 { return 5 }
650 if view[0] != 104 or view[7] != 101 { return 6 }
651
652 ; A lone continuation byte is rejected and the buffer stays unchanged.
653 bad: u8[2] = [255, 65]
654 rejected := OwnedString_append(&s, bad[0..2])
655 match rejected {
656 Ok(len) -> { return 7 }
657 Err(error) -> {
658 match error {

Callers

nothing calls this directly

Calls 1

run_kernel_hllFunction · 0.70

Tested by

no test coverage detected