//! unit tests for libertyparse use libertyparse::*; const LIBERTY_SIMPLE: &str = include_str!("simple_Early_simplify.lib"); #[test] fn test_simple() { clilog::init_stderr_color_debug(); let parsed = Liberty::parse_str(LIBERTY_SIMPLE).expect("parse error"); // clilog::debug!("Parsed is: {parsed:#?}"); assert_eq!(parsed.libs.len(), 1); assert_eq!(parsed.libs[0].0, "contest"); let lib = &parsed.libs[0].1; assert_eq!(lib.cells.len(), 4); assert_eq!(format!("{:?}", lib.cells.iter().map(|(s, _)| s.as_ref()).collect::>()), "[\"INV_X1\", \"INV_X2\", \"NOR4_Z80\", \"DFF_X80\"]"); let cell = &lib.cells[3].1; assert_eq!(cell.pins.len(), 3); assert_eq!(format!("{:?}", cell.pins.iter().map(|(s, _)| s.as_ref()).collect::>()), "[\"q\", \"ck\", \"d\"]"); // clilog::debug!("{:#?}", lib.cells[3].1); clilog::info!("Simple unparsed summary:"); parsed.debug_report_unparsed(); }