aboutsummaryrefslogtreecommitdiff
path: root/test/test.rs
blob: fb7452032be0c86165e5df0c4049f1b528a9e000 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// #![feature(test)]
//
// extern crate test;

extern crate yaxpeax_arch;
extern crate yaxpeax_arm;

mod armv7;
mod armv8;

use yaxpeax_arch::{Arch, Decoder, Reader, U8Reader};
use std::fmt;

#[test]
fn test_armv7_does_not_panic() {
    let armv7 = <yaxpeax_arm::armv7::ARMv7 as Arch>::Decoder::default();

    for i in 0..=u32::MAX {
        let bytes = i.to_le_bytes();
        let res = armv7.decode(&mut U8Reader::new(&bytes));
        if let Ok(instr) = res {
            let s = instr.to_string();
        }
    }
}
#[test]
fn test_armv7_thumb_does_not_panic() {
    let mut armv7_t = <yaxpeax_arm::armv7::ARMv7 as Arch>::Decoder::default();
    armv7_t.set_thumb_mode(true);

    for i in 0..=u32::MAX {
        let bytes = i.to_le_bytes();
        let res = armv7_t.decode(&mut U8Reader::new(&bytes));
        if let Ok(instr) = res {
            let s = instr.to_string();
        }
    }
}
#[ignore]
#[test]
fn test_armv8_does_not_panic() {
    let armv8 = <yaxpeax_arm::armv8::a64::ARMv8 as Arch>::Decoder::default();

    for i in 0..=u32::MAX {
        let bytes = i.to_le_bytes();
        let res = armv8.decode(&mut U8Reader::new(&bytes));
        if let Ok(instr) = res {
            let s = instr.to_string();
        }
    }
}