use super::*;
#[test]
fn the_enumerated_counts_are_pinned() {
let expected: Vec<(&str, usize, Vec<usize>)> = vec![
("semisimple(2)", 4, vec![1, 2, 1]),
("semisimple(3)", 8, vec![1, 3, 3, 1]),
("semisimple(4)", 16, vec![1, 4, 6, 4, 1]),
("linear_an(2)", 5, vec![1, 2, 2]),
("linear_an(3)", 14, vec![1, 3, 5, 5]),
("truncated_poly(3)", 2, vec![1, 1]),
("radical_square_zero_cycle(3)", 14, vec![1, 3, 6, 4]),
("linear_nakayama([2, 2, 1])", 12, vec![1, 3, 5, 3]),
];
for field in fields() {
let fixtures = catalog_fixtures(field);
assert_eq!(fixtures.len(), expected.len());
for ((name, catalog), (short, count, histogram)) in fixtures.iter().zip(&expected) {
assert!(name.starts_with(short), "{name} is not {short}");
let enumeration = enumerate_over_catalog(catalog).expect("the fixture enumerates");
assert_eq!(enumeration.len(), *count, "{name}");
assert_eq!(&enumeration.histogram(), histogram, "{name}");
assert_eq!(enumeration.provenance(), catalog.provenance());
assert_eq!(enumeration.catalog_len(), catalog.len());
assert!(!enumeration.is_empty());
assert!(enumeration.verify(), "{name}");
}
}
}
#[test]
fn the_dfs_node_count_is_the_number_of_tau_rigid_subsets() {
let expected = [
("semisimple(2)", 4usize),
("semisimple(3)", 8),
("semisimple(4)", 16),
("linear_an(2)", 6),
("linear_an(3)", 22),
("truncated_poly(3)", 2),
("radical_square_zero_cycle(3)", 20),
("linear_nakayama([2, 2, 1])", 16),
];
for field in fields() {
for ((name, catalog), (short, nodes)) in catalog_fixtures(field).iter().zip(&expected) {
assert!(name.starts_with(short), "{name} is not {short}");
let enumeration = enumerate_over_catalog(catalog).expect("the fixture enumerates");
let (count, histogram, brute_nodes) = brute_force(catalog);
assert_eq!(enumeration.nodes_visited(), *nodes, "{name}");
assert_eq!(enumeration.nodes_visited(), brute_nodes, "{name}");
assert_eq!(enumeration.len(), count, "{name}");
assert_eq!(enumeration.histogram(), histogram, "{name}");
}
}
}
#[test]
fn the_d4_enumeration_has_fifty_pairs() {
for field in fields() {
let algebra = d4(field);
let catalog = IndecomposableCatalog::dynkin(&algebra).expect("D_4 is Dynkin");
assert_eq!(catalog.len(), 12);
let enumeration = enumerate_over_catalog(&catalog).expect("D_4 enumerates");
assert_eq!(enumeration.len(), 50, "over F_{}", field.modulus());
assert_eq!(enumeration.histogram(), vec![1, 4, 9, 16, 20]);
let (count, histogram, nodes) = brute_force(&catalog);
assert_eq!(count, 50);
assert_eq!(histogram, vec![1, 4, 9, 16, 20]);
assert_eq!(enumeration.nodes_visited(), 120);
assert_eq!(enumeration.nodes_visited(), nodes);
assert_eq!(enumeration.provenance(), CatalogProvenance::DynkinZeroIdeal);
assert!(enumeration.verify(), "over F_{}", field.modulus());
}
}
#[test]
fn the_kronecker_algebra_has_no_catalog() {
for field in fields() {
let algebra = kronecker(2, field);
assert_eq!(
IndecomposableCatalog::nakayama(&algebra).unwrap_err(),
EnumerateError::NotNakayama {
vertex: 0,
incoming: 0,
outgoing: 2
}
);
assert!(matches!(
IndecomposableCatalog::dynkin(&algebra).unwrap_err(),
DynkinError::NotDynkin { .. }
));
}
}