opendp 0.14.2-dev.20260401.2

A library of differential privacy algorithms for the statistical analysis of sensitive private data.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::{error::Fallible, metrics::SymmetricDistance, transformations::then_clamp};

use super::*;

#[test]
fn test_make_clamp() -> Fallible<()> {
    let input_space = (VectorDomain::new(AtomDomain::default()), SymmetricDistance);
    let transformation = (input_space >> then_clamp((0, 10)))?;
    let arg = vec![-10, -5, 0, 5, 10, 20];
    let ret = transformation.invoke(&arg)?;
    let expected = vec![0, 0, 0, 5, 10, 10];
    assert_eq!(ret, expected);
    Ok(())
}