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

Function test_mmap_enabled_config

src/protocol/value_handler.rs:486–507  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

484
485 #[test]
486 fn test_mmap_enabled_config() {
487 let mut config = ValueHandlerConfig {
488 enable_mmap: true,
489 large_value_threshold: 100, // Very small threshold for testing
490 ..Default::default()
491 };
492 config.mmap_config.min_size_for_mmap = 50;
493
494 let handler = ValueHandler::with_config(config);
495 let large_text = "x".repeat(150); // Larger than threshold
496 let sqlite_value = SqliteValue::Text(large_text.clone());
497
498 let result = handler.convert_value(&sqlite_value, 25, false).unwrap(); // TEXT
499
500 // Should use memory mapping for large text when enabled
501 match result {
502 Some(mapped_value) => {
503 assert_eq!(mapped_value.as_slice(), large_text.as_bytes());
504 }
505 _ => panic!("Expected mapped value for large text"),
506 }
507 }
508}

Callers

nothing calls this directly

Calls 2

cloneMethod · 0.45
convert_valueMethod · 0.45

Tested by

no test coverage detected