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

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

class AssertionError extends Error {
  constructor(public location: string, public start: number, public end: number) {
    super(`assertion failed at ${location}`);
  }
}
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_assert_as_statement_still_works() {
  try {
    const deps = {};
    const { Money } = commerce_money as any;
    const m = Money.fromMinorUnits(5);
    if (!(m.tag === "Ok")) { throw __bynkAssertionFailure("offset 112", 112, 122); }
    const n = Money.fromMinorUnits(-1);
    if (!(n.tag === "Err")) { throw __bynkAssertionFailure("offset 171", 171, 182); }
    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: "assert as statement still works", ...(await test_assert_as_statement_still_works()) });
  return results;
}
