// SPDX-FileCopyrightText: 2022 Thomas Kramer // // SPDX-License-Identifier: AGPL-3.0-or-later // use std::fs::File; // use std::io::Read; // /// Read a whole file into a byte vector. // fn read_file(path: &str) -> Vec { // let mut f = File::open(path).unwrap(); // let mut data = Vec::new(); // f.read_to_end(&mut data).unwrap(); // data // } // GDS tests // #[test] // fn test_load_inverter_cell() { // let f = File::open("./tests/data/INVX1.gds").unwrap(); // let mut reader = BufReader::new(f); // let library = gds::Library::read(&mut reader).unwrap(); // dbg!(&library); // println!("{}", library); // dbg!(library.name); // // for st in library.structures { // dbg!(st.name); // for el in st.elements { // dbg!(el); // } // } // } // // #[test] // fn test_load_gds() { // let f = File::open("./tests/data/shapes_and_text.gds").unwrap(); // let mut reader = BufReader::new(f); // let library = gds::Library::read(&mut reader).unwrap(); // dbg!(&library); // println!("{}", library); // dbg!(library.name); // // for st in library.structures { // dbg!(st.name); // for el in st.elements { // dbg!(el); // } // } // } // #[test] fn test_delegate_core_traits() { use libreda_db::prelude::*; // Wrap a netlist/layout and delegate // the trait implementations to the inner data structure. #[allow(unused)] struct Wrapper { inner: N, } #[portrait::fill(portrait::delegate(N))] impl HierarchyIds for Wrapper where N: HierarchyIds {} #[portrait::fill(portrait::delegate(N; self.inner))] impl HierarchyBase for Wrapper where N: HierarchyBase {} #[portrait::fill(portrait::delegate(N; self.inner))] impl HierarchyEdit for Wrapper where N: HierarchyEdit {} #[portrait::fill(portrait::delegate(N))] impl NetlistIds for Wrapper where N: NetlistIds {} #[portrait::fill(portrait::delegate(N; self.inner))] impl NetlistBase for Wrapper where N: NetlistBase {} #[portrait::fill(portrait::delegate(N; self.inner))] impl NetlistEdit for Wrapper where N: NetlistEdit {} #[portrait::fill(portrait::delegate(N; self))] impl LayoutIds for Wrapper where N: LayoutIds {} #[portrait::fill(portrait::delegate(N; self.inner))] impl LayoutBase for Wrapper where N: LayoutBase {} #[portrait::fill(portrait::delegate(N; self.inner))] impl LayoutEdit for Wrapper where N: LayoutEdit {} #[portrait::fill(portrait::delegate(N; self.inner))] impl L2NBase for Wrapper where N: L2NBase {} #[portrait::fill(portrait::delegate(N; self.inner))] impl L2NEdit for Wrapper where N: L2NEdit {} }