// Generated by bynkc — do not edit by hand.
// test target: demo

import { Ok, Err, Some, None, type Result, type Option, type ValidationError } from "../runtime.js";
import * as demo from "./../demo.js";

class AssertionError extends Error {
  location: string;
  start: number;
  end: number;
  constructor(location: string, start: number, end: number) {
    super(`assertion failed at ${location}`);
    this.location = location;
    this.start = start;
    this.end = end;
  }
}
function __bynkAssertionFailure(location: string, start: number, end: number) {
  return new AssertionError(location, start, end);
}
function __bynkAssert(cond: boolean, location: string, start: number, end: number): void {
  if (!cond) { throw __bynkAssertionFailure(location, start, end); }
}

function makeTestDeps() {
  return {  };
}

async function test_doubles() {
  try {
    const deps = {};
    const { double } = demo as any;
    if (!(double(2) === 4)) { throw __bynkAssertionFailure("tests/demo.test.bynk:3:12", 42, 56); }
    return { pass: true };
  } catch (e) {
    if (e instanceof AssertionError) {
      return { pass: false, error: { message: e.message, location: e.location } };
    }
    return { pass: false, error: { message: String(e), location: "unknown" } };
  }
}

export async function run() {
  const results = [];
  results.push({ name: "doubles", ...(await test_doubles()) });
  return results;
}
