aboutsummaryrefslogtreecommitdiff
path: root/primrose/spec_code/example_unique.rs
blob: 34075f4aa3e5597ff71916013bee4da184fe97df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/*SPEC*
property unique<T> {
    \c <: (Container) -> ((for-all-elems c) \a -> ((unique-count? a) c))
}

type UniqueCon<S> = {c impl (Container) | (unique c)}
*ENDSPEC*/

fn main () {
    let mut c = UniqueCon::<u32>::new();
    for x in 0..10 {
        c.insert(x);
        c.insert(x);
        //c.first();
    }
    assert_eq!(c.len(), 10);
}