use anyhow::{bail, Result};

use crate::{
  bidir::synthesize,
  data::{Context, Term},
};

macro_rules! id_term {
  () => {
    Term::Lam("x".to_owned(), Box::new(Term::Var("x".to_owned())))
  };
}

#[test]
fn test_id() -> Result<()> {
  let id = id_term!();
  let ctx = Context::default();
  bail!("Result: {:?}", synthesize(&ctx, &id));
  Ok(())
}

#[test]
fn test_id_of_unit() -> Result<()> {
  let id = id_term!();
  let id_of_unit = Term::App(Box::new(id), Box::new(Term::Unit));
  let ctx = Context::default();
  bail!("Result: {:?}", synthesize(&ctx, &id_of_unit));
  Ok(())
}