flense 0.2.2

Purpose-oriented lensing
Documentation
//! Tests for [`Lens`].

#![allow(clippy::float_cmp)]

#[path = "./common.rs"]
mod common;

use assert2::assert;
use common::*;
use flense::prelude::*;

#[test]
fn split_lens() {
    let v = Vertex {
        position: [1.0, 2.0, 3.0],
        color: [4.0, 5.0, 6.0],
        normal: [7, 8],
        other: 0xCAFE,
    };
    let lens: Lens<'_, (Normal, Other, Color, Position)> = (&v).lens();
    let (lhs, rhs) = lens.split::<(Other, Position), _>();
    assert!(lhs.as_ref::<Other, _>() == &v.other);
    assert!(lhs.as_ref::<Position, _>() == &v.position);
    assert!(rhs.as_ref::<Normal, _>() == &v.normal);
    assert!(rhs.as_ref::<Color, _>() == &v.color);
}