pub struct SelectionReportAssertionChain<'a> { /* private fields */ }Expand description
A fluent assertion chain for inspecting a SelectionReport.
Obtain an instance via SelectionReportAssertions::should().
Assertion methods are chained on this struct and each return &mut Self so
multiple checks can be composed in a single expression.
Implementations§
Source§impl<'a> SelectionReportAssertionChain<'a>
impl<'a> SelectionReportAssertionChain<'a>
Sourcepub fn include_item_with_kind(&mut self, kind: ContextKind) -> &mut Self
pub fn include_item_with_kind(&mut self, kind: ContextKind) -> &mut Self
Asserts that at least one included item has the given kind.
Sourcepub fn include_item_matching(
&mut self,
predicate: impl Fn(&IncludedItem) -> bool,
) -> &mut Self
pub fn include_item_matching( &mut self, predicate: impl Fn(&IncludedItem) -> bool, ) -> &mut Self
Asserts that at least one included item satisfies predicate.
Sourcepub fn include_exact_n_items_with_kind(
&mut self,
kind: ContextKind,
n: usize,
) -> &mut Self
pub fn include_exact_n_items_with_kind( &mut self, kind: ContextKind, n: usize, ) -> &mut Self
Asserts that exactly n included items have the given kind.
Sourcepub fn exclude_item_with_reason(&mut self, reason: ExclusionReason) -> &mut Self
pub fn exclude_item_with_reason(&mut self, reason: ExclusionReason) -> &mut Self
Asserts that at least one excluded item carries the given reason variant.
Sourcepub fn exclude_item_matching_with_reason(
&mut self,
predicate: impl Fn(&ExcludedItem) -> bool,
reason: ExclusionReason,
) -> &mut Self
pub fn exclude_item_matching_with_reason( &mut self, predicate: impl Fn(&ExcludedItem) -> bool, reason: ExclusionReason, ) -> &mut Self
Asserts that at least one excluded item satisfies predicate and has the given reason variant.
Sourcepub fn have_excluded_item_with_budget_details(
&mut self,
predicate: impl Fn(&ExcludedItem) -> bool,
expected_item_tokens: i64,
expected_available_tokens: i64,
) -> &mut Self
pub fn have_excluded_item_with_budget_details( &mut self, predicate: impl Fn(&ExcludedItem) -> bool, expected_item_tokens: i64, expected_available_tokens: i64, ) -> &mut Self
Asserts that an excluded item matching predicate was excluded due to
BudgetExceeded with exactly the given expected_item_tokens and
expected_available_tokens.
Sourcepub fn have_no_exclusions_for_kind(&mut self, kind: ContextKind) -> &mut Self
pub fn have_no_exclusions_for_kind(&mut self, kind: ContextKind) -> &mut Self
Asserts that no excluded item has the given kind.
Sourcepub fn have_at_least_n_exclusions(&mut self, n: usize) -> &mut Self
pub fn have_at_least_n_exclusions(&mut self, n: usize) -> &mut Self
Asserts that the excluded list has at least n items.
Sourcepub fn excluded_items_are_sorted_by_score_descending(&mut self) -> &mut Self
pub fn excluded_items_are_sorted_by_score_descending(&mut self) -> &mut Self
Asserts that the excluded list is sorted in non-increasing score order.
Sourcepub fn have_budget_utilization_above(
&mut self,
threshold: f64,
budget: &ContextBudget,
) -> &mut Self
pub fn have_budget_utilization_above( &mut self, threshold: f64, budget: &ContextBudget, ) -> &mut Self
Asserts that sum(included tokens) / budget.max_tokens() >= threshold.
Sourcepub fn have_kind_coverage_count(&mut self, n: usize) -> &mut Self
pub fn have_kind_coverage_count(&mut self, n: usize) -> &mut Self
Asserts that the included list contains at least n distinct ContextKind values.
Sourcepub fn place_item_at_edge(
&mut self,
predicate: impl Fn(&IncludedItem) -> bool,
) -> &mut Self
pub fn place_item_at_edge( &mut self, predicate: impl Fn(&IncludedItem) -> bool, ) -> &mut Self
Asserts that an included item matching predicate is at position 0 or position count−1.
Sourcepub fn place_top_n_scored_at_edges(&mut self, n: usize) -> &mut Self
pub fn place_top_n_scored_at_edges(&mut self, n: usize) -> &mut Self
Asserts that the top-n scored included items occupy the n outermost edge positions.
Edge position mapping: 0, count−1, 1, count−2, … (alternating inward from both ends).
n = 0 always passes. n > included.len() panics with a count mismatch message.
Uses index-based approach — no HashSet<&IncludedItem> (f64 prevents Hash).