ocpi-tariffs 0.46.1

OCPI tariff calculations
Documentation
use super::{Path, PathPiece};

#[test]
fn path_should_cmp_with_str() {
    assert_ne!(Path::root(), "");
    assert_eq!(Path::root(), "$");
    assert_eq!(Path(vec![PathPiece::Object("field_a".into())]), "$.field_a");
    assert_eq!(Path(vec![PathPiece::Array(1)]), "$.1");
    assert_eq!(
        Path(vec![
            PathPiece::Object("field_a".into()),
            PathPiece::Array(1)
        ]),
        "$.field_a.1"
    );
}

#[test]
fn path_should_display() {
    assert_eq!(Path::root().to_string(), "$");
    assert_eq!(
        Path(vec![PathPiece::Object("field_a".into())]).to_string(),
        "$.field_a"
    );
    assert_eq!(Path(vec![PathPiece::Array(1)]).to_string(), "$.1");
    assert_eq!(
        Path(vec![
            PathPiece::Object("field_a".into()),
            PathPiece::Array(1)
        ])
        .to_string(),
        "$.field_a.1"
    );
}