module

MemoryBudget::SpecExpectations

Adds the same policy enforcement used by the CI command to Crystal specs.

Instance methods

within_allocation_budget(scenario_name : String, *, calls : Int, bytes : Int, warm_up_runs : Int32 = 0, &) : MemoryBudgetVerdict

Preserves the proven allocation helper while using the common checker.

Source
within_allocation_budget_per_item(scenario_name : String, *, list_of_item_counts : Enumerable(Int32), fixed_calls : Int, calls_per_item : Int, fixed_bytes : Int, bytes_per_item : Int, & : Int32 -> ) : Nil

Checks declared input sizes against checked fixed-plus-per-item limits.

Source
within_memory_budget(policy : ScenarioMemoryPolicy, &) : MemoryBudgetVerdict

Measures a block under a named typed policy and fails the current example on any invalid verdict.

Source
within_memory_budget(scenario_name : String, *, contract : ScenarioMemoryContract, &) : MemoryBudgetVerdict

Selects a named policy from the app-owned contract before running its block.

Source
within_process_allocation_budget(scenario_name : String, *, calls : Int, bytes : Int, &) : MemoryBudgetVerdict

Budgets a process operation whose workers finish inside the block.

Source