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

Function for_each_struct_array

tests/integration/hll_conformance.rs:392–413  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

390 );
391}
392
393#[test]
394fn for_each_struct_array() {
395 // Element is a struct value; field reads through the by-value binding.
396 // (1+2) + (3+4) + (5+6) = 21.
397 assert_exit(
398 r#"
399struct Point {
400 x: i32
401 y: i32
402}
403
404main: () -> i32 {
405 pts: Point[3] = [Point { .x = 1, .y = 2 }, Point { .x = 3, .y = 4 }, Point { .x = 5, .y = 6 }]
406 total: i32 = 0
407 for p in pts {
408 total = total + p.x + p.y
409 }
410 return total
411}
412"#,
413 21,
414 );
415}
416

Callers

nothing calls this directly

Calls 1

assert_exitFunction · 0.85

Tested by

no test coverage detected