Skip to content

Commit

Permalink
add explicit port of thermal bridging unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shieldo committed Apr 18, 2024
1 parent 4204a26 commit 04b20be
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/core/space_heat_demand/thermal_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,33 @@ mod test {
6.7
);
}

#[rstest]
pub fn test_heat_trans_coeff_for_linear() {
let tb = ThermalBridge::Linear {
linear_thermal_transmittance: 0.28,
length: 5.0,
};
assert_eq!(
round_by_precision(heat_transfer_coefficient_for_thermal_bridge(&tb), 1e6),
1.4,
"incorrect heat transfer coefficient returned"
);
}

#[rstest]
pub fn test_heat_trans_coeff_for_point() {
let tb = ThermalBridge::Point {
heat_transfer_coefficient: 1.4,
};
assert_eq!(
heat_transfer_coefficient_for_thermal_bridge(&tb),
1.4,
"incorrect heat transfer coefficient returned"
);
}

fn round_by_precision(src: f64, precision: f64) -> f64 {
(precision * src).round() / precision
}
}

0 comments on commit 04b20be

Please sign in to comment.