test: add FBIP and RC verification test cases
Add test cases demonstrating FBIP (Functional But In-Place) optimization: - test_fbip_clean.lux: Basic FBIP chain (map, filter, reverse) - test_fbip_allocs.lux: Single-owner allocation test with range/map/filter/reverse - test_no_fbip.lux: Demonstrates shared reference forcing rc>1 path - test_rc_comparison.lux: Comparison of FBIP vs non-FBIP allocations All tests verify no memory leaks with the RC system. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
9
examples/test_fbip_clean.lux
Normal file
9
examples/test_fbip_clean.lux
Normal file
@@ -0,0 +1,9 @@
|
||||
fn main(): Unit = {
|
||||
// Test FBIP without string operations
|
||||
let nums = [1, 2, 3, 4, 5]
|
||||
let doubled = List.map(nums, fn(x: Int): Int => x * 2)
|
||||
let filtered = List.filter(doubled, fn(x: Int): Bool => x > 4)
|
||||
let reversed = List.reverse(filtered)
|
||||
let len = List.length(reversed)
|
||||
Console.print("done")
|
||||
}
|
||||
Reference in New Issue
Block a user