use super::*;
use burn_tensor::TensorData;

#[test]
fn should_support_div_ops_int() {
    let data_1 = TensorData::from([[0, 1, 2], [3, 4, 5]]);
    let data_2 = TensorData::from([[1, 1, 2], [1, 1, 2]]);
    let device = Default::default();
    let tensor_1 = TestTensorInt::<2>::from_data(data_1, &device);
    let tensor_2 = TestTensorInt::<2>::from_data(data_2, &device);

    let output = tensor_1 / tensor_2;

    output
        .into_data()
        .assert_eq(&TensorData::from([[0, 1, 1], [3, 4, 2]]), false);
}

#[test]
fn test_div_broadcast_int() {
    let data_1 = TensorData::from([[0, 1, 2]]);
    let data_2 = TensorData::from([[1, 1, 2], [3, 4, 5]]);
    let device = Default::default();
    let tensor_1 = TestTensorInt::<2>::from_data(data_1, &device);
    let tensor_2 = TestTensorInt::<2>::from_data(data_2, &device);

    let output = tensor_1 / tensor_2;

    output
        .into_data()
        .assert_eq(&TensorData::from([[0, 1, 1], [0, 0, 0]]), false);
}

#[test]
fn should_support_div_scalar_ops_int() {
    let data = TensorData::from([[0, 1, 2], [3, 4, 5]]);
    let scalar = 2;
    let tensor = TestTensorInt::<2>::from_data(data, &Default::default());

    let output = tensor / scalar;

    output
        .into_data()
        .assert_eq(&TensorData::from([[0, 0, 1], [1, 2, 2]]), false);
}
