musig2/
key_sort.rs

1#[cfg(test)]
2mod tests {
3    use secp::Point;
4
5    #[test]
6    fn test_sort_public_keys() {
7        const KEY_SORT_VECTORS: &[u8] = include_bytes!("test_vectors/key_sort_vectors.json");
8
9        #[derive(serde::Deserialize)]
10        struct KeySortVectors {
11            pubkeys: Vec<Point>,
12            sorted_pubkeys: Vec<Point>,
13        }
14
15        let vectors: KeySortVectors = serde_json::from_slice(KEY_SORT_VECTORS)
16            .expect("failed to decode key_sort_vectors.json");
17
18        let mut pubkeys = vectors.pubkeys;
19        pubkeys.sort();
20        assert_eq!(pubkeys, vectors.sorted_pubkeys);
21    }
22}