Takes too long
()
| 1513 | #[test] |
| 1514 | #[cfg_attr(miri, ignore)] // Takes too long |
| 1515 | fn test_gc_huge_array() { |
| 1516 | // Construct multiple 128 MiB BinaryView entries so total > 4 GiB |
| 1517 | let block_len: usize = 128 * 1024 * 1024; // 128 MiB per view |
| 1518 | let num_views: usize = 36; |
| 1519 | |
| 1520 | // Create a single 128 MiB data block with a simple byte pattern |
| 1521 | let buffer = Buffer::from_vec(vec![0xAB; block_len]); |
| 1522 | let buffer2 = Buffer::from_vec(vec![0xFF; block_len]); |
| 1523 | |
| 1524 | // Append this block and then add many views pointing to it |
| 1525 | let mut builder = BinaryViewBuilder::new(); |
| 1526 | let block_id = builder.append_block(buffer); |
| 1527 | for _ in 0..num_views / 2 { |
| 1528 | builder |
| 1529 | .try_append_view(block_id, 0, block_len as u32) |
| 1530 | .expect("append view into 128MiB block"); |
| 1531 | } |
| 1532 | let block_id2 = builder.append_block(buffer2); |
| 1533 | for _ in 0..num_views / 2 { |
| 1534 | builder |
| 1535 | .try_append_view(block_id2, 0, block_len as u32) |
| 1536 | .expect("append view into 128MiB block"); |
| 1537 | } |
| 1538 | |
| 1539 | let array = builder.finish(); |
| 1540 | let total = array.total_buffer_bytes_used(); |
| 1541 | assert!( |
| 1542 | total > u32::MAX as usize, |
| 1543 | "Expected total non-inline bytes to exceed 4 GiB, got {}", |
| 1544 | total |
| 1545 | ); |
| 1546 | |
| 1547 | // Run gc and verify correctness |
| 1548 | let gced = array.gc(); |
| 1549 | assert_eq!(gced.len(), num_views, "Length mismatch after gc"); |
| 1550 | assert_eq!(gced.null_count(), 0, "Null count mismatch after gc"); |
| 1551 | assert_ne!( |
| 1552 | gced.data_buffers().len(), |
| 1553 | 1, |
| 1554 | "gc with huge buffer should not consolidate data into a single buffer" |
| 1555 | ); |
| 1556 | |
| 1557 | // Element-wise equality check across the entire array |
| 1558 | array.iter().zip(gced.iter()).for_each(|(orig, got)| { |
| 1559 | assert_eq!(orig, got, "Value mismatch after gc on huge array"); |
| 1560 | }); |
| 1561 | } |
| 1562 | |
| 1563 | #[test] |
| 1564 | fn test_eq() { |
nothing calls this directly
no test coverage detected