aboutsummaryrefslogtreecommitdiff
path: root/crates/equix/tests/equix_hash.rs
blob: bbd95821365a1d38e025071c6667843a54770005 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//! Additional tests for Equi-X's usage of HashX

use equix::{EquiX, Error, HashError};

#[test]
fn bad_hashx_seeds() {
    // The hashx crate has a lot more vectors, we just need to test the API.
    assert!(matches!(
        EquiX::new(b"tvfdrjb"),
        Err(Error::Hash(HashError::ProgramConstraints)),
    ));
    assert!(matches!(
        EquiX::new(b"zuneuh"),
        Err(Error::Hash(HashError::ProgramConstraints)),
    ));
    assert!(matches!(
        EquiX::new(b"augbcgc"),
        Err(Error::Hash(HashError::ProgramConstraints)),
    ));
    assert!(matches!(
        EquiX::new(b"ldspzed"),
        Err(Error::Hash(HashError::ProgramConstraints)),
    ));
}

#[test]
fn edge_case_hashx_seeds() {
    // A few seeds that hit register allocation retries inside HashX
    assert!(EquiX::new(b"aeloscc").is_ok());
    assert!(EquiX::new(b"fysixgb").is_ok());
    assert!(EquiX::new(b"snxunsc").is_ok());
    assert!(EquiX::new(b"sdbwwmb").is_ok());
}