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

Function cross_module_call_works

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

Source from the content-addressed store, hash-verified

660 Alloc(inner) -> { return 8 }
661 }
662 }
663 }
664 if OwnedString_length(&s) != 8 { return 9 }
665
666 OwnedString_clear(&s)
667 if OwnedString_length(&s) != 0 { return 10 }
668 OwnedString_deinit(&s)
669 return 0
670}
671"#,
672 );
673 assert_eq!(exit, Some(0));
674}
675
676#[test]
677fn hosted_arena_bumps_resets_and_reuses() {
678 let (_, exit) = run_hll(
679 r#"
680memory_allocator := import("memory_allocator")
681
682main: () -> i32 {
683 a: Arena = { .head = null }
684 Arena_init(&a)
685
686 first: u8* = null
687 first_result := Arena_alloc(&a, 24, 8)
688 match first_result {
689 Ok(value) -> { first = value }
690 Err(error) -> { return 1 }
691 }
692 if (first as u64) % 8 != 0 { return 2 }
693 first[0] = 7
694
695 second: u8* = null
696 second_result := Arena_alloc(&a, 40, 64)
697 match second_result {
698 Ok(value) -> { second = value }
699 Err(error) -> { return 3 }
700 }
701 if (second as u64) % 64 != 0 { return 4 }
702 if second == first { return 5 }
703
704 ; Larger than the default chunk: gets its own chunk.
705 big_result := Arena_alloc(&a, 8192, 8)
706 match big_result {
707 Ok(value) -> {}
708 Err(error) -> { return 6 }
709 }
710

Callers

nothing calls this directly

Calls 9

compile_stdlib_objectsFunction · 0.85
set_write_artifactsMethod · 0.80
assemble_namedMethod · 0.80
collectMethod · 0.80
pushMethod · 0.80
compileMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected