use core::panic;
use std::path::PathBuf;
use crate::Jeff;
const TEST_PROGRAMS_DIR: &str = "../../examples/";
#[rstest::fixture]
pub fn qubits() -> Jeff<'static> {
load_example_program("qubits")
}
#[rstest::fixture]
pub fn entangled_qs() -> Jeff<'static> {
load_example_program("entangled_qs")
}
#[rstest::fixture]
pub fn entangled_calls() -> Jeff<'static> {
load_example_program("entangled_calls")
}
fn load_example_program(name: &str) -> Jeff<'static> {
let filename = format!("{name}.jeff");
let path = PathBuf::from(TEST_PROGRAMS_DIR).join(name).join(filename);
let file = std::fs::File::open(&path).unwrap();
let buffer = std::io::BufReader::new(file);
Jeff::read(buffer).unwrap_or_else(|e| panic!("Failed to read example program: {}", e))
}