qubit-function 0.17.0

Functional programming traits and Box/Rc/Arc adapters for Rust, inspired by Java functional interfaces
// =============================================================================
//    Copyright (c) 2026 Haixing Hu.
//
//    SPDX-License-Identifier: Apache-2.0
//
//    Licensed under the Apache License, Version 2.0.
// =============================================================================

use qubit_function::{
    BoxFunction,
    Function,
};

#[test]
fn test_box_conditional_function_macro_behavior() {
    let function = BoxFunction::new(|value: &i32| value + 1)
        .when(|value: &i32| *value > 0)
        .or_else(|_: &i32| 0);
    assert_eq!(function.apply(&41), 42);
    assert_eq!(function.apply(&-1), 0);
}