import { Effect } from "effect";
import { expect } from "vitest";
import { Environment, evaluate } from "../lib/evaluator.js";
import { Decimal } from "../lib/decimal.js";
export class TestEnvironment extends Environment {
  evalSync(expr, ctx) {
    return Effect.runSync(this.evaluate(expr, ctx));
  }
}
export function evalSync(expr, ctx) {
  return Effect.runSync(evaluate(expr, ctx));
}
export function expectDecimal(result, expected) {
  expect(result).toBeInstanceOf(Decimal);
  const exp = Decimal.from(expected);
  expect(result.eq(exp)).toBe(true);
}
export const env = new TestEnvironment({ unlistedVariablesAreDyn: true });
