#![warn(absolute_paths_not_starting_with_crate)]
#![warn(ambiguous_negative_literals)]
#![warn(closure_returning_async_block)]
#![warn(deprecated_in_future)]
#![warn(deprecated_safe)]
#![warn(deref_into_dyn_supertrait)]
#![warn(edition_2024_expr_fragment_specifier)]
#![warn(elided_lifetimes_in_paths)]
#![warn(explicit_outlives_requirements)]
#![warn(ffi_unwind_calls)]
#![warn(if_let_rescope)]
#![warn(impl_trait_overcaptures)]
#![warn(impl_trait_redundant_captures)]
#![warn(keyword_idents)]
#![warn(let_underscore_drop)]
#![warn(macro_use_extern_crate)]
#![warn(meta_variable_misuse)]
#![warn(missing_copy_implementations)]
#![warn(missing_debug_implementations)]
#![warn(missing_docs)]
#![warn(missing_unsafe_on_extern)]
#![warn(non_ascii_idents)]
#![warn(redundant_imports)]
#![warn(redundant_lifetimes)]
#![warn(single_use_lifetimes)]
#![warn(tail_expr_drop_order)]
#![warn(trivial_casts)]
#![warn(trivial_numeric_casts)]
#![warn(unit_bindings)]
#![warn(unnameable_types)]
#![warn(unreachable_pub)]
#![warn(unsafe_attr_outside_unsafe)]
#![warn(unsafe_code)]
#![warn(unsafe_op_in_unsafe_fn)]
#![warn(unused)]
#![warn(unused_crate_dependencies)]
#![warn(unused_import_braces)]
#![warn(unused_lifetimes)]
#![warn(unused_qualifications)]
#![warn(unused_results)]
#![warn(variant_size_differences)]
use nom as _;
use nom_locate as _;
use serde as _;
use serde_json as _;
use smallvec as _;
use thiserror as _;
fn run_test(name: &str, text: &str) {
let l = gedcom_core::data::lines(text).unwrap();
let r = gedcom_core::data::records(text).unwrap();
insta::with_settings!({
prepend_module_to_snapshot => false,
snapshot_path => "files"
}, {
let mut name_lines: String = name.into();
name_lines.push_str("-lines");
insta::assert_ron_snapshot!(name_lines, l);
let mut name_records: String = name.into();
name_records.push_str("-records");
insta::assert_ron_snapshot!(name_records, r);
});
}
const COMPLETE: &str = include_str!("files/complete.ged");
#[test]
fn test_complete() {
assert_eq!(63526, COMPLETE.len());
run_test("complete", COMPLETE);
}
const SAMPLE_UTF8: &str = include_str!("files/sample555-utf8.ged");
#[test]
fn test_sample_utf8() {
assert_eq!(1986, SAMPLE_UTF8.len());
run_test("sample_utf8", SAMPLE_UTF8);
}
const SAMPLE_UTF16LE: &[u8] = include_bytes!("files/sample555-utf16le.ged");
#[test]
fn test_sample_utf16le() {
assert_eq!(3972, SAMPLE_UTF16LE.len());
let (enc, _) = encoding_rs::Encoding::for_bom(SAMPLE_UTF16LE).unwrap();
let input = enc
.decode_without_bom_handling_and_without_replacement(SAMPLE_UTF16LE)
.unwrap();
run_test("sample_utf16le", &input);
}
const SAMPLE_UTF16BE: &[u8] = include_bytes!("files/sample555-utf16be.ged");
#[test]
fn test_sample_utf16be() {
assert_eq!(3972, SAMPLE_UTF16BE.len());
let (enc, _) = encoding_rs::Encoding::for_bom(SAMPLE_UTF16BE).unwrap();
let input = enc
.decode_without_bom_handling_and_without_replacement(SAMPLE_UTF16BE)
.unwrap();
run_test("sample_utf16be", &input);
}
const REMARR: &str = include_str!("files/remarr.ged");
#[test]
fn test_remarr() {
assert_eq!(1233, REMARR.len());
run_test("remarr", REMARR);
}
const SSMARR: &str = include_str!("files/ssmarr.ged");
#[test]
fn test_ssmarr() {
assert_eq!(864, SSMARR.len());
run_test("ssmarr", SSMARR);
}
const MINIMAL: &str = include_str!("files/minimal555.ged");
#[test]
fn test_minimal() {
assert_eq!(132, MINIMAL.len());
run_test("minimal", MINIMAL);
}
const MARRIED1200: &str = include_str!("files/married1200.ged");
#[test]
fn test_married1200() {
assert_eq!(220057, MARRIED1200.len());
run_test("married1200", MARRIED1200);
}
const CHILDREN1200: &str = include_str!("files/children1200.ged");
#[test]
fn test_children1200() {
assert_eq!(169419, CHILDREN1200.len());
run_test("children1200", CHILDREN1200);
}
const SIBLINGS1200: &str = include_str!("files/siblings1200.ged");
#[test]
fn test_siblings1200() {
assert_eq!(399500, SIBLINGS1200.len());
run_test("siblings1200", SIBLINGS1200);
}
const LONG26CC: &str = include_str!("files/long26cc.ged");
#[test]
fn test_long26cc() {
assert_eq!(9094, LONG26CC.len());
run_test("long26cc", LONG26CC);
}