use std::f32::consts::{E, PI};
use smallvec::smallvec;
use morok_dtype::DType;
use crate::{ConstValue, SInt, UOp, error::Error};
#[test]
fn test_void_type_in_binary_op() {
let void1 = UOp::const_(DType::Void, crate::ConstValue::Int(0));
let void2 = UOp::const_(DType::Void, crate::ConstValue::Int(0));
let result = void1.try_add(&void2);
assert!(matches!(result, Err(Error::VoidTypeInOp)));
}
#[test]
fn test_type_promotion_failed() {
let result = UOp::native_const(5i32).try_add(&UOp::native_const(PI));
assert!(result.is_ok());
}
#[test]
fn test_invalid_dtype_for_bitwise_op() {
let result = UOp::native_const(PI).try_and_op(&UOp::native_const(5i32));
assert!(matches!(result, Err(Error::InvalidDTypeForBinaryOp { .. })));
let result = UOp::native_const(PI).try_or_op(&UOp::native_const(5i32));
assert!(matches!(result, Err(Error::InvalidDTypeForBinaryOp { .. })));
let result = UOp::native_const(PI).try_xor_op(&UOp::native_const(5i32));
assert!(matches!(result, Err(Error::InvalidDTypeForBinaryOp { .. })));
let result = UOp::native_const(PI).try_shl_op(&UOp::native_const(5i32));
assert!(matches!(result, Err(Error::InvalidDTypeForBinaryOp { .. })));
let result = UOp::native_const(PI).try_shr_op(&UOp::native_const(5i32));
assert!(matches!(result, Err(Error::InvalidDTypeForBinaryOp { .. })));
}
#[test]
fn test_index_type_mismatch() {
use crate::DeviceSpec;
let buffer = UOp::new_buffer(DeviceSpec::Cpu, 100, DType::Float32);
let result = UOp::index().buffer(buffer).indices(vec![UOp::native_const(0.0f32)]).call();
assert!(matches!(result, Err(Error::IndexTypeMismatch { .. })));
}
#[test]
fn test_division_by_zero_const() {
let result = UOp::native_const(10i32).try_div(&UOp::native_const(0i32));
assert!(matches!(result, Err(Error::DivisionByZero)));
let result = UOp::native_const(10i32).try_mod(&UOp::native_const(0i32));
assert!(matches!(result, Err(Error::DivisionByZero)));
}
#[test]
fn test_division_by_zero_float() {
let result = UOp::native_const(10.0f32).try_div(&UOp::native_const(0.0f32));
assert!(matches!(result, Err(Error::DivisionByZero)));
}
#[test]
fn test_reshape_size_mismatch() {
use crate::shape::Shape;
let output_shape: Shape = smallvec![SInt::from(2), SInt::from(2)];
let result = UOp::native_const(1.0f32).try_reshape(&output_shape);
assert!(matches!(result, Err(Error::ReshapeSizeMismatch { input_size: 1, output_size: 4 })));
}
#[test]
fn test_reshape_negative_dimension() {
let shape: crate::shape::Shape = smallvec![SInt::from(1)];
let result = UOp::native_const(1.0f32).try_reshape(&shape);
assert!(result.is_ok());
}
#[test]
fn test_shrink_bounds_violation() {
use crate::shape::Shape;
let _shape: Shape = smallvec![SInt::from(5), SInt::from(10)];
}
#[test]
fn test_expand_dimension_mismatch() {
use crate::shape::Shape;
let output_shape: Shape = smallvec![SInt::from(3), SInt::from(5)];
let result = UOp::native_const(1.0f32).try_expand(&output_shape);
assert!(matches!(result, Err(Error::ExpandDimensionMismatch { input_dims: 0, output_dims: 2 })));
}
#[test]
fn test_expand_invalid_dimension() {
}
#[test]
fn test_permute_invalid_permutation() {
let val = UOp::native_const(1.0f32);
let result = val.clone().try_permute(vec![0, 1]);
assert!(matches!(result, Err(Error::PermuteInvalidPermutation { .. })));
let result = val.try_permute(vec![]);
assert!(result.is_ok());
}
#[test]
fn test_pad_dimension_mismatch() {
let padding = vec![(SInt::from(0), SInt::from(0)), (SInt::from(1), SInt::from(1))];
let result = UOp::native_const(1.0f32).try_pad(&padding);
assert!(matches!(result, Err(Error::PadDimensionMismatch { padding_dims: 2, shape_dims: 0 })));
}
#[test]
fn test_flip_invalid_spec() {
let flip_spec = vec![true, false];
let result = UOp::native_const(1.0f32).try_flip(flip_spec);
assert!(matches!(result, Err(Error::FlipInvalidSpec { expected_dims: 0, got_dims: 2 })));
}
#[test]
fn test_comparison_with_void_type() {
let void1 = UOp::const_(DType::Void, crate::ConstValue::Int(0));
let void2 = UOp::const_(DType::Void, crate::ConstValue::Int(0));
let result = void1.try_cmplt(&void2);
assert!(matches!(result, Err(Error::VoidTypeInOp)));
let result = void1.try_cmpeq(&void2);
assert!(matches!(result, Err(Error::VoidTypeInOp)));
let result = void1.try_cmpne(&void2);
assert!(matches!(result, Err(Error::VoidTypeInOp)));
}
#[test]
fn test_comparison_bool_dtype_result() {
assert_eq!(UOp::native_const(5i32).try_cmplt(&UOp::native_const(10i32)).unwrap().dtype(), DType::Bool);
assert_eq!(UOp::native_const(5i32).try_cmpeq(&UOp::native_const(10i32)).unwrap().dtype(), DType::Bool);
assert_eq!(UOp::native_const(5i32).try_cmpne(&UOp::native_const(10i32)).unwrap().dtype(), DType::Bool);
assert_eq!(UOp::native_const(PI).try_cmplt(&UOp::native_const(E)).unwrap().dtype(), DType::Bool);
assert_eq!(UOp::native_const(PI).try_cmpeq(&UOp::native_const(E)).unwrap().dtype(), DType::Bool);
assert_eq!(UOp::native_const(PI).try_cmpne(&UOp::native_const(E)).unwrap().dtype(), DType::Bool);
}
#[test]
fn test_where_condition_must_be_bool() {
let result = UOp::try_where(UOp::native_const(1i32), UOp::native_const(1.0f32), UOp::native_const(0.0f32));
assert!(result.is_err(), "Non-bool condition should fail");
let bool_result = UOp::try_where(
UOp::const_(DType::Bool, ConstValue::Bool(true)),
UOp::native_const(1.0f32),
UOp::native_const(0.0f32),
);
assert!(bool_result.is_ok(), "Bool condition should succeed");
}
#[test]
fn test_where_branch_dtype_compatibility() {
let result = UOp::try_where(
UOp::const_(DType::Bool, ConstValue::Bool(true)),
UOp::native_const(5i32),
UOp::native_const(5.0f32),
)
.unwrap();
assert_eq!(result.dtype(), DType::Int32);
}
#[test]
fn test_mulacc_preserves_first_operand_dtype() {
let result =
UOp::try_mulacc(UOp::native_const(2.0f32), UOp::native_const(3.0f32), UOp::native_const(4.0f32)).unwrap();
assert_eq!(result.dtype(), DType::Float32);
}
#[test]
fn test_mulacc_rejects_mismatched_dtypes() {
let result = UOp::try_mulacc(UOp::native_const(2.0f32), UOp::native_const(3.0f32), UOp::native_const(4i32));
assert!(result.is_err());
}
#[test]
fn test_sqrt_preserves_dtype() {
assert_eq!(UOp::native_const(4.0f32).try_sqrt().unwrap().dtype(), DType::Float32);
assert_eq!(UOp::native_const(4.0f64).try_sqrt().unwrap().dtype(), DType::Float64);
}
#[test]
fn test_transcendental_on_int_types() {
let int_val = UOp::native_const(4i32);
let sqrt_result = int_val.try_sqrt();
assert!(matches!(sqrt_result, Err(Error::InvalidDTypeForUnaryOp { .. })));
let exp2_result = int_val.try_exp2();
assert!(matches!(exp2_result, Err(Error::InvalidDTypeForUnaryOp { .. })));
let log2_result = int_val.clone().try_log2();
assert!(matches!(log2_result, Err(Error::InvalidDTypeForUnaryOp { .. })));
}
#[test]
fn test_bind_value_out_of_range() {
}
#[test]
fn test_index_out_of_bounds() {
}
#[test]
fn test_pad_negative_value() {
}
#[test]
fn test_shape_mismatch_elementwise() {
}
#[test]
fn test_broadcast_shape_mismatch() {
let shape1 = smallvec![SInt::from(3), SInt::from(4)];
let shape2 = smallvec![SInt::from(3), SInt::from(5)];
let result = crate::shape::broadcast_shape(&shape1, &shape2);
assert!(matches!(result, Err(Error::BroadcastShapeMismatch { .. })));
}
#[test]
fn test_broadcast_shapes_multiple_mismatch() {
let shape1 = smallvec![SInt::from(1), SInt::from(5)];
let shape2 = smallvec![SInt::from(3), SInt::from(4)]; let shape3 = smallvec![SInt::from(3), SInt::from(5)];
let result = crate::shape::broadcast_shapes(&[shape1, shape2, shape3]);
assert!(result.is_err());
}
#[test]
fn test_and_all_int_types() {
let val_i8 = UOp::const_(DType::Int8, ConstValue::Int(15));
let val_i16 = UOp::const_(DType::Int16, ConstValue::Int(255));
let val_i32 = UOp::native_const(1023i32);
let val_i64 = UOp::native_const(4095i64);
let result_i8 = val_i8.try_and_op(&val_i8);
assert!(result_i8.is_ok());
assert_eq!(result_i8.unwrap().dtype(), DType::Int8);
let result_i16 = val_i16.try_and_op(&val_i16);
assert!(result_i16.is_ok());
assert_eq!(result_i16.unwrap().dtype(), DType::Int16);
assert_eq!(val_i32.try_and_op(&val_i32).unwrap().dtype(), DType::Int32);
let result_i64 = val_i64.try_and_op(&val_i64);
assert!(result_i64.is_ok());
assert_eq!(result_i64.unwrap().dtype(), DType::Int64);
}
#[test]
fn test_or_all_uint_types() {
let val_u8 = UOp::const_(DType::UInt8, ConstValue::UInt(15));
let val_u16 = UOp::const_(DType::UInt16, ConstValue::UInt(255));
let val_u32 = UOp::native_const(1023u32);
let val_u64 = UOp::native_const(4095u64);
let result_u8 = val_u8.try_or_op(&val_u8);
assert!(result_u8.is_ok());
let u8_dtype = result_u8.unwrap().dtype();
assert!(u8_dtype == DType::UInt8 || u8_dtype == DType::Int16);
let result_u16 = val_u16.try_or_op(&val_u16);
assert!(result_u16.is_ok());
let u16_dtype = result_u16.unwrap().dtype();
assert!(u16_dtype == DType::UInt16 || u16_dtype == DType::Int32);
let result_u32 = val_u32.try_or_op(&val_u32);
assert!(result_u32.is_ok());
let u32_dtype = result_u32.unwrap().dtype();
assert!(u32_dtype == DType::UInt32 || u32_dtype == DType::Int64);
let result_u64 = val_u64.try_or_op(&val_u64);
assert!(result_u64.is_ok());
assert_eq!(result_u64.unwrap().dtype(), DType::UInt64);
}
#[test]
fn test_xor_mixed_signedness() {
let signed = UOp::native_const(42i32);
let unsigned = UOp::native_const(24u32);
let result = signed.try_xor_op(&unsigned);
assert!(result.is_ok());
}
#[test]
fn test_shifts_all_types() {
let i8_val = UOp::const_(DType::Int8, ConstValue::Int(4));
let i16_val = UOp::const_(DType::Int16, ConstValue::Int(16));
let i32_val = UOp::native_const(256i32);
let u32_val = UOp::native_const(1024u32);
let shift_amt = UOp::native_const(2i32);
let shl_i8 = i8_val.try_shl_op(&shift_amt);
assert!(shl_i8.is_ok());
assert_eq!(shl_i8.unwrap().dtype(), DType::Int8);
let shl_i16 = i16_val.try_shl_op(&shift_amt);
assert!(shl_i16.is_ok());
assert_eq!(shl_i16.unwrap().dtype(), DType::Int16);
let shl_i32 = i32_val.try_shl_op(&shift_amt);
assert!(shl_i32.is_ok());
assert_eq!(shl_i32.unwrap().dtype(), DType::Int32);
let shr_i16 = i16_val.try_shr_op(&shift_amt);
assert!(shr_i16.is_ok());
assert_eq!(shr_i16.unwrap().dtype(), DType::Int16);
let shr_u32 = u32_val.try_shr_op(&shift_amt);
assert!(shr_u32.is_ok());
assert_eq!(shr_u32.unwrap().dtype(), DType::UInt32);
}
#[test]
fn test_shl_by_zero() {
let value = UOp::native_const(42i32);
let zero_shift = UOp::native_const(0i32);
let result = value.try_shl_op(&zero_shift);
assert!(result.is_ok());
}
#[test]
fn test_shr_by_zero() {
let value = UOp::native_const(42i32);
let zero_shift = UOp::native_const(0i32);
let result = value.try_shr_op(&zero_shift);
assert!(result.is_ok());
}
#[test]
fn test_shl_large_amount() {
let value = UOp::native_const(1i32);
let large_shift = UOp::native_const(40i32);
let result = value.try_shl_op(&large_shift);
assert!(result.is_ok());
}
#[test]
fn test_shift_preserves_lhs_dtype_all_types() {
let shift_amt = UOp::native_const(1i32);
let types_and_values = vec![
(DType::Int8, ConstValue::Int(10)),
(DType::Int16, ConstValue::Int(100)),
(DType::Int32, ConstValue::Int(1000)),
(DType::Int64, ConstValue::Int(10000)),
(DType::UInt8, ConstValue::UInt(10)),
(DType::UInt16, ConstValue::UInt(100)),
(DType::UInt32, ConstValue::UInt(1000)),
(DType::UInt64, ConstValue::UInt(10000)),
];
for (dtype, value) in types_and_values {
let val = UOp::const_(dtype.clone(), value);
let shl_result = val.try_shl_op(&shift_amt);
assert!(shl_result.is_ok());
assert_eq!(shl_result.unwrap().dtype(), dtype);
let shr_result = val.try_shr_op(&shift_amt);
assert!(shr_result.is_ok());
assert_eq!(shr_result.unwrap().dtype(), dtype);
}
}
#[test]
fn test_and_with_min_max_int8() {
let min_val = UOp::const_(DType::Int8, ConstValue::Int(i8::MIN as i64));
let max_val = UOp::const_(DType::Int8, ConstValue::Int(i8::MAX as i64));
let zero = UOp::const_(DType::Int8, ConstValue::Int(0));
let result = min_val.try_and_op(&min_val);
assert!(result.is_ok());
let result = max_val.try_and_op(&max_val);
assert!(result.is_ok());
let result = min_val.try_and_op(&max_val);
assert!(result.is_ok());
let result = min_val.try_and_op(&zero);
assert!(result.is_ok());
let result = max_val.try_and_op(&zero);
assert!(result.is_ok());
}
#[test]
fn test_or_with_min_max_values() {
let i32_min = UOp::const_(DType::Int32, ConstValue::Int(i32::MIN as i64));
let i32_max = UOp::const_(DType::Int32, ConstValue::Int(i32::MAX as i64));
let result = i32_min.try_or_op(&i32_max);
assert!(result.is_ok());
let u32_min = UOp::const_(DType::UInt32, ConstValue::UInt(u32::MIN as u64));
let u32_max = UOp::const_(DType::UInt32, ConstValue::UInt(u32::MAX as u64));
let result = u32_min.try_or_op(&u32_max);
assert!(result.is_ok());
}
#[test]
fn test_xor_with_min_max_values() {
let i16_min = UOp::const_(DType::Int16, ConstValue::Int(i16::MIN as i64));
let i16_max = UOp::const_(DType::Int16, ConstValue::Int(i16::MAX as i64));
let result = i16_min.try_xor_op(&i16_max);
assert!(result.is_ok());
let result = i16_min.try_xor_op(&i16_min);
assert!(result.is_ok());
let result = i16_max.try_xor_op(&i16_max);
assert!(result.is_ok());
}
#[test]
fn test_shift_at_boundaries() {
let i32_min = UOp::const_(DType::Int32, ConstValue::Int(i32::MIN as i64));
let i32_max = UOp::const_(DType::Int32, ConstValue::Int(i32::MAX as i64));
let shift_one = UOp::native_const(1i32);
let result = i32_min.try_shl_op(&shift_one);
assert!(result.is_ok());
let result = i32_min.try_shr_op(&shift_one);
assert!(result.is_ok());
let result = i32_max.try_shl_op(&shift_one);
assert!(result.is_ok());
let result = i32_max.try_shr_op(&shift_one);
assert!(result.is_ok());
}
#[test]
fn test_bool_add_behavior() {
let bool_true = UOp::const_(DType::Bool, ConstValue::Bool(true));
let bool_false = UOp::const_(DType::Bool, ConstValue::Bool(false));
let result = bool_true.try_add(&bool_false);
assert!(result.is_ok());
let result = bool_true.try_add(&bool_false);
assert!(result.is_ok());
}
#[test]
fn test_bool_mul_behavior() {
let bool_true = UOp::const_(DType::Bool, ConstValue::Bool(true));
let bool_false = UOp::const_(DType::Bool, ConstValue::Bool(false));
let result = bool_true.try_mul(&bool_false);
assert!(result.is_ok());
let result = bool_true.try_mul(&bool_false);
assert!(result.is_ok());
}
#[test]
fn test_bool_with_int_promotion() {
let bool_val = UOp::const_(DType::Bool, ConstValue::Bool(true));
let int_val = UOp::native_const(42i32);
let result = bool_val.try_add(&int_val);
assert!(result.is_ok());
let result = bool_val.try_mul(&int_val);
assert!(result.is_ok());
}
#[test]
fn test_bitwise_int8_operations() {
let a = UOp::const_(DType::Int8, ConstValue::Int(0x0F));
let b = UOp::const_(DType::Int8, ConstValue::Int(0x33));
let and_result = a.try_and_op(&b);
assert!(and_result.is_ok());
assert_eq!(and_result.unwrap().dtype(), DType::Int8);
let or_result = a.try_or_op(&b);
assert!(or_result.is_ok());
assert_eq!(or_result.unwrap().dtype(), DType::Int8);
let xor_result = a.try_xor_op(&b);
assert!(xor_result.is_ok());
assert_eq!(xor_result.unwrap().dtype(), DType::Int8);
let shift_amt = UOp::const_(DType::Int8, ConstValue::Int(2));
let shl_result = a.try_shl_op(&shift_amt);
assert!(shl_result.is_ok());
assert_eq!(shl_result.unwrap().dtype(), DType::Int8);
let shr_result = a.try_shr_op(&shift_amt);
assert!(shr_result.is_ok());
assert_eq!(shr_result.unwrap().dtype(), DType::Int8);
}
#[test]
fn test_bitwise_int16_operations() {
let a = UOp::const_(DType::Int16, ConstValue::Int(0x0F0F));
let b = UOp::const_(DType::Int16, ConstValue::Int(0x3333));
let and_result = a.try_and_op(&b);
assert!(and_result.is_ok());
assert_eq!(and_result.unwrap().dtype(), DType::Int16);
let or_result = a.try_or_op(&b);
assert!(or_result.is_ok());
assert_eq!(or_result.unwrap().dtype(), DType::Int16);
let xor_result = a.try_xor_op(&b);
assert!(xor_result.is_ok());
assert_eq!(xor_result.unwrap().dtype(), DType::Int16);
}
#[test]
fn test_bitwise_uint8_operations() {
let a = UOp::const_(DType::UInt8, ConstValue::UInt(0xFF));
let b = UOp::const_(DType::UInt8, ConstValue::UInt(0xAA));
let and_result = a.try_and_op(&b);
assert!(and_result.is_ok());
let and_dtype = and_result.unwrap().dtype();
assert!(and_dtype == DType::UInt8 || and_dtype == DType::Int16);
let or_result = a.try_or_op(&b);
assert!(or_result.is_ok());
let or_dtype = or_result.unwrap().dtype();
assert!(or_dtype == DType::UInt8 || or_dtype == DType::Int16);
let xor_result = a.try_xor_op(&b);
assert!(xor_result.is_ok());
let xor_dtype = xor_result.unwrap().dtype();
assert!(xor_dtype == DType::UInt8 || xor_dtype == DType::Int16);
}
#[test]
fn test_bitwise_uint16_operations() {
let a = UOp::const_(DType::UInt16, ConstValue::UInt(0xFFFF));
let b = UOp::const_(DType::UInt16, ConstValue::UInt(0xAAAA));
let and_result = a.try_and_op(&b);
assert!(and_result.is_ok());
let and_dtype = and_result.unwrap().dtype();
assert!(and_dtype == DType::UInt16 || and_dtype == DType::Int32);
let or_result = a.try_or_op(&b);
assert!(or_result.is_ok());
let or_dtype = or_result.unwrap().dtype();
assert!(or_dtype == DType::UInt16 || or_dtype == DType::Int32);
let xor_result = a.try_xor_op(&b);
assert!(xor_result.is_ok());
let xor_dtype = xor_result.unwrap().dtype();
assert!(xor_dtype == DType::UInt16 || xor_dtype == DType::Int32);
}
#[test]
fn test_all_int_types_with_and() {
let int_types = vec![
(DType::Int8, ConstValue::Int(15)),
(DType::Int16, ConstValue::Int(255)),
(DType::Int32, ConstValue::Int(1023)),
(DType::Int64, ConstValue::Int(4095)),
(DType::UInt8, ConstValue::UInt(15)),
(DType::UInt16, ConstValue::UInt(255)),
(DType::UInt32, ConstValue::UInt(1023)),
(DType::UInt64, ConstValue::UInt(4095)),
];
for (dtype, value) in int_types {
let a = UOp::const_(dtype.clone(), value);
let b = UOp::const_(dtype.clone(), value);
let result = a.try_and_op(&b);
assert!(result.is_ok());
}
}
#[test]
fn test_all_int_types_with_or() {
let int_types = vec![
(DType::Int8, ConstValue::Int(8)),
(DType::Int16, ConstValue::Int(128)),
(DType::Int32, ConstValue::Int(512)),
(DType::Int64, ConstValue::Int(2048)),
(DType::UInt8, ConstValue::UInt(8)),
(DType::UInt16, ConstValue::UInt(128)),
(DType::UInt32, ConstValue::UInt(512)),
(DType::UInt64, ConstValue::UInt(2048)),
];
for (dtype, value) in int_types {
let a = UOp::const_(dtype.clone(), value);
let b = UOp::const_(dtype.clone(), value);
let result = a.try_or_op(&b);
assert!(result.is_ok());
}
}
#[test]
fn test_all_int_types_with_xor() {
let int_types = vec![
(DType::Int8, ConstValue::Int(7)),
(DType::Int16, ConstValue::Int(63)),
(DType::Int32, ConstValue::Int(255)),
(DType::Int64, ConstValue::Int(1023)),
(DType::UInt8, ConstValue::UInt(7)),
(DType::UInt16, ConstValue::UInt(63)),
(DType::UInt32, ConstValue::UInt(255)),
(DType::UInt64, ConstValue::UInt(1023)),
];
for (dtype, value) in int_types {
let a = UOp::const_(dtype.clone(), value);
let b = UOp::const_(dtype.clone(), value);
let result = a.try_xor_op(&b);
assert!(result.is_ok());
}
}
#[test]
fn test_bitwise_with_void_lhs() {
let void_val = UOp::const_(DType::Void, crate::ConstValue::Int(0));
let int_val = UOp::native_const(42i32);
let result = void_val.try_and_op(&int_val);
assert!(result.is_err());
let result = void_val.try_or_op(&int_val);
assert!(result.is_err());
let result = void_val.try_xor_op(&int_val);
assert!(result.is_err());
}
#[test]
fn test_bitwise_with_void_rhs() {
let int_val = UOp::native_const(42i32);
let void_val = UOp::const_(DType::Void, crate::ConstValue::Int(0));
let result = int_val.try_and_op(&void_val);
assert!(result.is_err());
let result = int_val.try_or_op(&void_val);
assert!(result.is_err());
let result = int_val.try_xor_op(&void_val);
assert!(result.is_err());
}
#[test]
fn test_shift_void_error() {
let void_val = UOp::const_(DType::Void, crate::ConstValue::Int(0));
let int_val = UOp::native_const(1i32);
let result = void_val.try_shl_op(&int_val);
assert!(matches!(result, Err(Error::InvalidDTypeForBinaryOp { .. })));
let result = void_val.try_shr_op(&int_val);
assert!(matches!(result, Err(Error::InvalidDTypeForBinaryOp { .. })));
}
#[test]
fn test_invalid_type_combinations() {
let float_val = UOp::native_const(PI);
let int_val = UOp::native_const(42i32);
let result = float_val.try_and_op(&int_val);
assert!(result.is_err());
let result = float_val.try_or_op(&int_val);
assert!(result.is_err());
let result = float_val.try_xor_op(&int_val);
assert!(result.is_err());
let result = float_val.try_shl_op(&int_val);
assert!(result.is_err());
let result = float_val.try_shr_op(&int_val);
assert!(result.is_err());
}