| 5 | |
| 6 | #[test] |
| 7 | fn test_component_creation() { |
| 8 | let _session = Session::new().expect("Failed to initialize session"); |
| 9 | let out_dir = env!("OUT_DIR").parse::<PathBuf>().unwrap(); |
| 10 | let view = binaryninja::load(out_dir.join("atox.obj")).expect("Failed to create view"); |
| 11 | let component = ComponentBuilder::new(view.clone()).name("test").finalize(); |
| 12 | assert_eq!(component.name().as_str(), "test"); |
| 13 | let root_component = view.root_component().unwrap(); |
| 14 | // We should only have our component. |
| 15 | assert_eq!(root_component.components().len(), 1); |
| 16 | assert!( |
| 17 | root_component.contains_component(&component), |
| 18 | "Component not found in root component" |
| 19 | ); |
| 20 | } |