MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_buffer_capacity_limit

Function test_buffer_capacity_limit

src/protocol/buffer_pool.rs:460–477  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

458
459 #[test]
460 fn test_buffer_capacity_limit() {
461 let config = BufferPoolConfig {
462 max_buffer_capacity: 1024,
463 initial_buffer_capacity: 512,
464 ..Default::default()
465 };
466 let pool = BufferPool::with_config(config);
467
468 // Allocate and grow a buffer beyond limit
469 {
470 let mut buffer = pool.get_buffer();
471 buffer.buffer_mut().resize(2048, 0); // Grow beyond limit
472 }
473
474 let stats = pool.get_stats();
475 assert_eq!(stats.buffers_discarded, 1); // Should be discarded
476 assert_eq!(stats.current_pool_size, 0);
477 }
478
479 #[test]
480 fn test_buffer_cleanup() {

Callers

nothing calls this directly

Calls 3

get_bufferMethod · 0.80
buffer_mutMethod · 0.80
get_statsMethod · 0.45

Tested by

no test coverage detected