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

Function allows_stack_and_heap_arrays

tests/integration/spec_rules.rs:195–220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

193
194#[test]
195fn allows_stack_and_heap_arrays() {
196 let source = r#"
197main: () -> i32 {
198 stack: i32[3] = []
199 stack[0] = 1
200 stack[1] = 2
201 stack[2] = stack[0] + stack[1]
202
203 heap: i32* = new(i32, 2)
204 defer free(heap)
205 heap[0] = stack[2]
206 heap[1] = 4
207
208 return heap[0] + heap[1]
209}
210"#;
211
212 let mut pipeline = CompilationPipeline::new();
213 pipeline.set_write_artifacts(false);
214 let result = pipeline.compile(source);
215 assert!(
216 result.is_ok(),
217 "expected stack and heap arrays to compile successfully: {:?}",
218 result.err()
219 );
220}
221
222#[test]
223fn allows_array_literals_through_assembly() {

Callers

nothing calls this directly

Calls 2

set_write_artifactsMethod · 0.80
compileMethod · 0.45

Tested by

no test coverage detected