atmosim 0.1.0

A library for calculating most efficient gas bombs in Space Station 14 game
Documentation
use atmosim::prelude::*;

#[test]
fn heat_capacity_caching_works() {
    let engine = Atmosim::default();

    // For some reason this reacts for eternity
    // Note this is just a mixture, not a tank.
    // A tank would just explode with this, lol
    let mut mix = engine.create_mixture(
        gases! {
            Gas::Ammonia | Gas::CarbonDioxide | Gas::Frezon |
            Gas::Nitrogen | Gas::NitrousOxide | Gas::Oxygen |
            Gas::Plasma | Gas::Tritium | Gas::WaterVapor => 100.,
            _ => 0.,
        },
        500.,
    );

    // 1 hour of 0.001% accuracy should be more than enough.
    // If it only fails after an hour, that's f32 issue, not the logic one.
    // The fix would be to just recalculate cache every 1000 ticks or so.
    for tick in 0..7200 {
        assert!(
            mix.react(),
            "The mix stopped reacting too soon, only lasted {tick} ticks"
        );
        let cached = mix.get_heat_capacity();
        let real = GasMixture::calculate_heat_capacity(mix.moles(), &engine);
        assert!(
            (cached - real).abs() / cached < 0.00001,
            "Caching precision wasn't good enough, only lasted {tick} ticks"
        )
    }
}