import "std/slice.zc" import "std/io.zc" test "slice from array iteration" { let ints: int[5] = [1, 2, 3, 4, 5]; let slice = Slice::from_array((int*)(&ints), 5); // Test iteration let sum = 0; for val in slice { sum = sum + val; } if (sum != 15) { panic("Slice iteration failed: expected sum 15"); } } test "slice methods" { let arr: int[3] = [10, 20, 30]; let slice = Slice::from_array((int*)(&arr), 3); if (slice.length() != 3) panic("Slice length wrong"); if (slice.is_empty()) panic("Slice should not be empty"); let opt = slice.get(1); if (opt.is_none()) panic("Slice get failed"); if (opt.unwrap() != 20) panic("Slice get returned wrong value"); }