use super::parser::{decompress, parse_project_information};
#[test]
fn copy_token_decoder() {
const CONTAINER_1: &[u8] = b"\x01\x27\xB0\x00\x41\x74\x74\x72\x69\x62\x75\x74\x00\x65\x20\x56\x42\x5F\x4E\x61\x6D\x00\x65\x20\x3D\x20\x22\x61\x22\x0D\x80\x0A\x61\x62\x63\x64\x65\x66\x06\xF0\x00\x0D\x0A";
const CONTENTS_1: &[u8] = b"Attribute VB_Name = \"a\"\x0D\x0AabcdefAttribute\x0D\x0A";
let contents = decompress(CONTAINER_1).unwrap().1;
assert_eq!(contents, CONTENTS_1);
const CONTAINER_2: &[u8] = b"\x01\x28\xB0\x00\x41\x74\x74\x72\x69\x62\x75\x74\x00\x65\x20\x56\x42\x5F\x4E\x61\x6D\x00\x65\x20\x3D\x20\x22\x61\x22\x0D\x00\x0A\x61\x62\x63\x64\x65\x66\x67\x01\x06\xF8\x0D\x0A";
const CONTENTS_2: &[u8] = b"Attribute VB_Name = \"a\"\x0D\x0AabcdefgAttribute\x0D\x0A";
let contents = decompress(CONTAINER_2).unwrap().1;
assert_eq!(contents, CONTENTS_2);
const CONTAINER_3: &[u8] = b"\x01\x29\xB0\x00\x41\x74\x74\x72\x69\x62\x75\x74\x00\x65\x20\x56\x42\x5F\x4E\x61\x6D\x00\x65\x20\x3D\x20\x22\x61\x22\x0D\x00\x0A\x61\x62\x63\x64\x65\x66\x67\x02\x68\x06\x80\x0D\x0A";
const CONTENTS_3: &[u8] = b"Attribute VB_Name = \"a\"\x0D\x0AabcdefghAttribute\x0D\x0A";
let contents = decompress(CONTAINER_3).unwrap().1;
assert_eq!(contents, CONTENTS_3);
}
#[test]
fn proj_info_opt_records() {
const INPUT_NONE_NONE: &[u8] = b"\x01\x00\x04\x00\x00\x00\x02\x00\x00\x00\
\x02\x00\x04\x00\x00\x00\x09\x04\x00\x00\
\x14\x00\x04\x00\x00\x00\x09\x04\x00\x00\
\x03\x00\x02\x00\x00\x00\xE4\x04\
\x04\x00\x01\x00\x00\x00\x41\
\x05\x00\x01\x00\x00\x00\x41\x40\x00\x02\x00\x00\x00\x41\x00\
\x06\x00\x00\x00\x00\x00\x3D\x00\x00\x00\x00\x00\
\x07\x00\x04\x00\x00\x00\x00\x00\x00\x00\
\x08\x00\x04\x00\x00\x00\x00\x00\x00\x00\
\x09\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x0F\x00\x02\x00\x00\x00\x00\x00\
\x13\x00\x02\x00\x00\x00\xFF\xFF\
\x10\x00\
\x00\x00\x00\x00";
let res = parse_project_information(INPUT_NONE_NONE);
assert!(res.is_ok());
let res = res.unwrap();
assert!(res.1.information.constants.is_none());
const INPUT_NONE_SOME: &[u8] = b"\x01\x00\x04\x00\x00\x00\x02\x00\x00\x00\
\x02\x00\x04\x00\x00\x00\x09\x04\x00\x00\
\x14\x00\x04\x00\x00\x00\x09\x04\x00\x00\
\x03\x00\x02\x00\x00\x00\xE4\x04\
\x04\x00\x01\x00\x00\x00\x41\
\x05\x00\x01\x00\x00\x00\x41\x40\x00\x02\x00\x00\x00\x41\x00\
\x06\x00\x00\x00\x00\x00\x3D\x00\x00\x00\x00\x00\
\x07\x00\x04\x00\x00\x00\x00\x00\x00\x00\
\x08\x00\x04\x00\x00\x00\x00\x00\x00\x00\
\x09\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x0C\x00\x00\x00\x00\x00\x3C\x00\x00\x00\x00\x00\
\x0F\x00\x02\x00\x00\x00\x00\x00\
\x13\x00\x02\x00\x00\x00\xFF\xFF\
\x10\x00\
\x00\x00\x00\x00";
let res = parse_project_information(INPUT_NONE_SOME);
assert!(res.is_ok());
let res = res.unwrap();
assert!(res.1.information.constants.is_some());
const INPUT_SOME_NONE: &[u8] = b"\x01\x00\x04\x00\x00\x00\x02\x00\x00\x00\
\x4A\x00\x04\x00\x00\x00\x01\x02\x03\x04\
\x02\x00\x04\x00\x00\x00\x09\x04\x00\x00\
\x14\x00\x04\x00\x00\x00\x09\x04\x00\x00\
\x03\x00\x02\x00\x00\x00\xE4\x04\
\x04\x00\x01\x00\x00\x00\x41\
\x05\x00\x01\x00\x00\x00\x41\x40\x00\x02\x00\x00\x00\x41\x00\
\x06\x00\x00\x00\x00\x00\x3D\x00\x00\x00\x00\x00\
\x07\x00\x04\x00\x00\x00\x00\x00\x00\x00\
\x08\x00\x04\x00\x00\x00\x00\x00\x00\x00\
\x09\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x0F\x00\x02\x00\x00\x00\x00\x00\
\x13\x00\x02\x00\x00\x00\xFF\xFF\
\x10\x00\
\x00\x00\x00\x00";
let res = parse_project_information(INPUT_SOME_NONE);
assert!(res.is_ok());
const INPUT_SOME_SOME: &[u8] = b"\x01\x00\x04\x00\x00\x00\x02\x00\x00\x00\
\x4A\x00\x04\x00\x00\x00\x01\x02\x03\x04\
\x02\x00\x04\x00\x00\x00\x09\x04\x00\x00\
\x14\x00\x04\x00\x00\x00\x09\x04\x00\x00\
\x03\x00\x02\x00\x00\x00\xE4\x04\
\x04\x00\x01\x00\x00\x00\x41\
\x05\x00\x01\x00\x00\x00\x41\x40\x00\x02\x00\x00\x00\x41\x00\
\x06\x00\x00\x00\x00\x00\x3D\x00\x00\x00\x00\x00\
\x07\x00\x04\x00\x00\x00\x00\x00\x00\x00\
\x08\x00\x04\x00\x00\x00\x00\x00\x00\x00\
\x09\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x0C\x00\x00\x00\x00\x00\x3C\x00\x00\x00\x00\x00\
\x0F\x00\x02\x00\x00\x00\x00\x00\
\x13\x00\x02\x00\x00\x00\xFF\xFF\
\x10\x00\
\x00\x00\x00\x00";
let res = parse_project_information(INPUT_SOME_SOME);
assert!(res.is_ok());
}