use proka_exec::Parser;
static SAMPLE: &[u8] = include_bytes!("testbin/sample.pke");
static TEXT: [u8; 8] = [0xeb, 0xfe, 0x66, 0x90, 0x00, 0x00, 0x00, 0x00];
static DATA: [u8; 8] = [0x01, 0x02, 0x03, 0x04, 0x05, 0x11, 0x45, 0x14];
#[inline]
fn init() -> Parser<'static> {
Parser::init(SAMPLE).unwrap()
}
#[test]
fn test_is_init_work() {
let _ = init();
}
#[test]
fn test_is_validation_correct() {
let parser = init();
let result = parser.validate();
assert_eq!(result, Ok(()));
}
#[test]
fn test_is_section_content_getter_work() {
let parser = init();
let content = parser.get_section_content(".text").unwrap();
let expected = TEXT;
assert_eq!(content, expected);
let content = parser.get_section_content(".data").unwrap();
let expected = DATA;
assert_eq!(content, expected);
}
#[should_panic]
#[test]
fn test_is_section_not_found_work() {
let parser = init();
parser.get_section_content(".wtf").unwrap(); }