lcax_calculation 3.4.3

LCAx is an open, machine and human-readable data format for exchanging LCA results.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::fs;
use std::path::Path;

use lcax_calculation::calculate::calculate_project;
use lcax_models::project::Project;

#[test]
fn test_calculate_project() -> Result<(), String> {
    let root_dir = Path::new(env!("CARGO_MANIFEST_DIR"));

    let file_path = root_dir.join("tests/datafixtures/project.json");
    let contents = fs::read_to_string(file_path).expect("Should have been able to read the file");
    let mut project = serde_json::from_str::<Project>(&contents).unwrap();

    calculate_project(&mut project, None)?;
    assert!(project.results.is_some());
    Ok(())
}