Add more checks and add functional coverage for bifurcation_detector (#28068)
This pull request strengthens input validation and significantly expands
test coverage for the `BifurcationDetector` operator. The main logic
change enforces that `prev_suffix_match_idx` must be non-negative,
preventing invalid input. The test suite is enhanced with a wide range
of scenarios, including edge cases, error handling, and attribute-based
behaviors.
**Input validation improvements:**
* Added a check to ensure `prev_suffix_match_idx` is non-negative in the
`BifurcationDetector` kernel, improving robustness against invalid input
values.
**Test coverage enhancements:**
* Added comprehensive tests for various bifurcation and suffix matching
scenarios, including:
- Bifurcation at the first token, mid-sequence, and with non-zero
`prev_suffix_match_idx`.
- Suffix matching with unique and multiple n-gram occurrences, handling
of n-gram size attributes, and output length edge cases.
- Combined bifurcation and suffix match logic.
* Added tests to verify correct handling of invalid or boundary inputs:
- Negative and excessively negative `prev_suffix_match_idx` values are
correctly rejected.
- `prev_suffix_match_idx` exceeding the source token length is rejected.
- Boundary case where `prev_suffix_match_idx` equals the source token
length is handled.
* Added tests for cases with no prediction tokens, ensuring output
matches expectations.