use matten::Tensor;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let t = Tensor::new((1..=12).map(|x| x as f64).collect(), &[3, 4]);
println!("\"0, :\" = {:?}", t.slice_str("0, :")?);
println!("\"0:2, :\" = {:?}", t.slice_str("0:2, :")?);
println!("\":, 1:3\" = {:?}", t.slice_str(":, 1:3")?);
let a = t.slice_str("0:2, :")?;
let b = t.slice_str(" 0:2 , : ")?;
assert_eq!(a, b);
println!("whitespace-insensitive: OK");
let from_str = t.slice_str("0:2, :")?;
let from_builder = t.slice().range(0..2).all().build()?;
assert_eq!(from_str, from_builder);
println!("builder == slice_str: OK");
println!("bad spec: {:?}", t.slice_str("0::"));
Ok(())
}