()
| 666 | kshutdown(1) |
| 667 | return |
| 668 | } |
| 669 | kshutdown(0) |
| 670 | } |
| 671 | "#, |
| 672 | ] |
| 673 | .concat(); |
| 674 | let (_, exit) = run_kernel_hll(&src); |
| 675 | assert_eq!( |
| 676 | exit, |
| 677 | Some(0), |
| 678 | "malloc(0) must be coerced to malloc(1) and return non-null" |
| 679 | ); |
| 680 | } |
| 681 | |
| 682 | #[test] |
| 683 | fn malloc_write_read_roundtrip() { |
| 684 | let src = [ |
| 685 | MALLOC_PRELUDE, |
| 686 | r#" |
| 687 | kmain: () { |
| 688 | p: i64* = malloc(8) as i64* |
| 689 | if p == null { |
| 690 | kshutdown(1) |
| 691 | return |
| 692 | } |
| 693 | @p = 12345 |
| 694 | if @p != 12345 { |
nothing calls this directly
no test coverage detected