#![allow(dead_code)] mod platform_ram;mod frame_authority; use frame_authority::{Allocator,Plan,Error,MAX_LIVE};use platform_ram::Region; fn main(){assert_eq!(MAX_LIVE,80);let mut a=Allocator::uninitialized();a.initialize(Plan::already_admitted(&[Region{start:0x40000000,end:0x50000000}]).unwrap(),2100).unwrap(); let addresses:[u64;74]=[1073741824, 1073745920, 1073750016, 1073754112, 1073758208, 1073762304, 1073766400, 1073770496, 1073774592, 1073778688, 1073782784, 1073786880, 1073790976, 1073795072, 1073799168, 1073803264, 1073807360, 1073811456, 1073815552, 1073819648, 1073823744, 1073827840, 1073831936, 1073836032, 1073840128, 1073844224, 1073848320, 1073852416, 1073856512, 1073860608, 1073864704, 1073868800, 1073872896, 1073876992, 1073881088, 1073885184, 1073889280, 1073893376, 1073897472, 1073901568, 1073905664, 1073909760, 1073913856, 1073917952, 1073922048, 1073926144, 1073930240, 1073934336, 1073938432, 1073942528, 1073946624, 1073950720, 1073954816, 1073958912, 1073963008, 1073967104, 1073971200, 1073975296, 1073979392, 1073983488, 1073987584, 1073991680, 1073995776, 1073999872, 1074003968, 1074008064, 1074012160, 1074016256, 1074020352, 1074024448, 1074028544, 1074032640, 1074036736, 1074040832];let retired:[u64;30]=[1073799168, 1073803264, 1073807360, 1073811456, 1073815552, 1073819648, 1073823744, 1073827840, 1073831936, 1073836032, 1073840128, 1073844224, 1073848320, 1073852416, 1073856512, 1073860608, 1073864704, 1073868800, 1073872896, 1073876992, 1073881088, 1073885184, 1073889280, 1073893376, 1073897472, 1073901568, 1073905664, 1073909760, 1073913856, 1073917952];let mut owned=addresses.into_iter().map(|p|Some(a.allocate_at(p).unwrap())).collect::>();let before=a.audit().unwrap();assert_eq!(before.live_pages,74); let mut rx=Vec::new();for i in 0..6{rx.push(a.allocate_at(1341734912u64+i*4096).unwrap());}let full=a.audit().unwrap();assert_eq!(full.live_pages,80);assert_eq!(a.allocate_at(1341734912u64+6*4096).err(),Some(Error::Capacity));assert_eq!(a.audit().unwrap(),full); for p in rx{a.release(&p).unwrap();}assert_eq!(a.audit().unwrap(),before); for address in retired{let i=owned.iter().position(|p|p.as_ref().is_some_and(|p|p.address()==address)).unwrap();let p=owned[i].take().unwrap();a.release(&p).unwrap();} let ready=a.audit().unwrap();assert_eq!(ready.live_pages,44);let mut rx=Vec::new();for i in 0..7{rx.push(a.allocate_at(1341734912u64+i*4096).unwrap());}assert_eq!(a.audit().unwrap().live_pages,51);for p in rx{a.release(&p).unwrap();}assert_eq!(a.audit().unwrap(),ready); let mut process=Vec::new();for _ in 0..34{process.push(a.allocate().unwrap());}assert_eq!(a.audit().unwrap().live_pages,78);for p in process{a.release(&p).unwrap();}assert_eq!(a.audit().unwrap(),ready);println!("actual_native_allocator: original74+RX7 rejected_at_80; early_retire30 ->44; RX7=51; process_peak=78; limit80 unchanged; all acquired leases returned");}