MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / test_event_log_compression_ratio

Function test_event_log_compression_ratio

ra-tls/src/cert.rs:670–684  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

668
669 #[test]
670 fn test_event_log_compression_ratio() {
671 // Simulate a reasonably large, highly repetitive event log payload.
672 // Keep it well below MAX_EVENTLOG_EXT_SIZE so decompression succeeds.
673 let large_data = vec![b'a'; (MAX_EVENTLOG_EXT_SIZE / 2) as usize];
674
675 let compressed = compress_ext_value(&large_data).unwrap();
676 let ratio = compressed.len() as f64 / large_data.len() as f64;
677
678 // Compression should achieve at least 50% reduction for repetitive data
679 assert!(ratio < 0.5, "compression ratio {} should be < 0.5", ratio);
680
681 // Verify decompression works
682 let decompressed = decompress_ext_value(&compressed).unwrap();
683 assert_eq!(decompressed, large_data);
684 }
685
686 #[test]
687 fn test_csr_v2_scale_encoding_stable() {

Callers

nothing calls this directly

Calls 3

compress_ext_valueFunction · 0.85
decompress_ext_valueFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected