/**
 * Shared test helpers for numeric invariants tests.
 *
 * Re-exports mocha/chai and provides factory functions for IR nodes
 * used across all numeric-invariant topic test files.
 */
export { describe, it } from "mocha";
export { expect } from "chai";
export { runNumericProofPass } from "../numeric-proof-pass.js";
/**
 * Helper to create a minimal module with statements
 */
export const createModule = (body, filePath = "/src/test.ts") => ({
    kind: "module",
    filePath,
    namespace: "Test",
    className: "test",
    isStaticContainer: true,
    imports: [],
    body,
    exports: [],
});
/**
 * Helper to create a variable declaration with an expression
 */
export const createVarDecl = (name, init, declarationKind = "const") => ({
    kind: "variableDeclaration",
    declarationKind,
    isExported: false,
    declarations: [
        {
            kind: "variableDeclarator",
            name: { kind: "identifierPattern", name },
            initializer: init,
        },
    ],
});
/**
 * Helper to create a numeric literal
 */
export const numLiteral = (value, raw) => ({
    kind: "literal",
    value,
    raw: raw ?? String(value),
    inferredType: { kind: "primitiveType", name: "number" },
});
/**
 * Helper to create a numeric narrowing expression
 * INVARIANT: "Int32" -> primitiveType(name="int"), others -> referenceType
 */
export const narrowTo = (expr, targetKind) => ({
    kind: "numericNarrowing",
    expression: expr,
    targetKind,
    inferredType: targetKind === "Int32"
        ? { kind: "primitiveType", name: "int" }
        : { kind: "referenceType", name: targetKind },
});
/**
 * Helper to create an identifier expression
 */
export const ident = (name) => ({
    kind: "identifier",
    name,
    inferredType: { kind: "primitiveType", name: "number" },
});
/**
 * Helper to create an array access expression
 * Includes accessKind: "clrIndexer" to match IR build behavior
 */
export const arrayAccess = (object, index) => ({
    kind: "memberAccess",
    object,
    property: index,
    isComputed: true,
    isOptional: false,
    accessKind: "clrIndexer", // Set by IR converter for array types
    inferredType: { kind: "primitiveType", name: "number" },
});
/**
 * Helper to create an array identifier
 */
export const arrayIdent = (name) => ({
    kind: "identifier",
    name,
    inferredType: {
        kind: "arrayType",
        elementType: { kind: "primitiveType", name: "number" },
    },
});
/**
 * Helper to create a binary expression
 */
export const binaryExpr = (operator, left, right) => ({
    kind: "binary",
    operator,
    left,
    right,
    inferredType: { kind: "primitiveType", name: "number" },
});
/**
 * Helper to create a logical expression.
 */
export const logicalExpr = (operator, left, right, inferredType) => ({
    kind: "logical",
    operator,
    left,
    right,
    inferredType,
});
export const booleanType = { kind: "primitiveType", name: "boolean" };
export const memberCall = (objectName, methodName, args, inferredType = booleanType) => ({
    kind: "call",
    callee: {
        kind: "memberAccess",
        object: ident(objectName),
        property: methodName,
        isComputed: false,
        isOptional: false,
        inferredType: { kind: "unknownType" },
    },
    arguments: args,
    isOptional: false,
    inferredType,
});
export const compareExpr = (operator, left, right) => ({
    kind: "binary",
    operator,
    left,
    right,
    inferredType: booleanType,
});
export const block = (statements) => ({
    kind: "blockStatement",
    statements,
});
export const parameter = (name, type) => ({
    kind: "parameter",
    pattern: { kind: "identifierPattern", name },
    type,
    isOptional: false,
    isRest: false,
    passing: "value",
});
/**
 * Helper to create an array expression
 */
export const arrayExpr = (elements) => ({
    kind: "array",
    elements,
    inferredType: {
        kind: "arrayType",
        elementType: { kind: "primitiveType", name: "number" },
    },
});
export const conditionalExpr = (condition, whenTrue, whenFalse, inferredType) => ({
    kind: "conditional",
    condition,
    whenTrue,
    whenFalse,
    inferredType,
});
//# sourceMappingURL=helpers.js.map