use atmosim::prelude::*;
#[test]
fn tank_explodes() {
let engine = Atmosim::default();
let mix = engine.create_mixture(
gases! {
Gas::Oxygen => 1.,
Gas::Tritium => 0.5,
_ => 0.,
},
373.149,
);
let mut tank = GasContainer::new(mix);
tank.step_all();
eprintln!("{:?}", tank.state());
assert!(matches!(
tank.state(),
GasContainerState::Exploded { radius: (4.0..5.0) }
))
}
#[test]
fn tank_doesnt_explode() {
let engine = Atmosim::default();
let mix = engine.create_mixture(
gases! {
Gas::Oxygen => 1.,
Gas::Plasma => 0.5,
_ => 0.,
},
373.149,
);
let mut tank = GasContainer::new(mix);
tank.step_all();
eprintln!("{:?}", tank.state());
assert!(matches!(tank.state(), GasContainerState::Idle))
}
#[test]
fn canister_explodes() {
let engine = Atmosim::new(GameConfig::wizden_canister());
let mix = engine.create_mixture(
gases! {
Gas::Oxygen => 1400.,
Gas::Tritium => 700.,
_ => 0.,
},
373.149,
);
let mut can = GasContainer::new(mix);
can.step_all();
eprintln!("{:?}", can.state());
assert!(matches!(
can.state(),
GasContainerState::Exploded {
radius: (30.0..31.0)
}
))
}
#[test]
fn canister_doesnt_explode() {
let engine = Atmosim::new(GameConfig::wizden_canister());
let mix = engine.create_mixture(
gases! {
Gas::Oxygen => 1400.,
Gas::Plasma => 700.,
_ => 0.,
},
373.149,
);
let mut can = GasContainer::new(mix);
can.step_all();
eprintln!("{:?}", can.state());
assert!(matches!(can.state(), GasContainerState::Idle))
}
#[test]
fn old_tank_explodes() {
let engine = Atmosim::new(GameConfig::wizden_pmr());
let mix = engine.create_mixture(
gases! {
Gas::Oxygen => 0.953378,
Gas::Plasma => 0.309855,
Gas::Tritium => 0.523134,
_ => 0.,
},
373.2523,
);
let mut tank = GasContainer::new(mix);
tank.step_all();
eprintln!("{:?}", tank.state());
assert!(matches!(
tank.state(),
GasContainerState::Exploded {
radius: (26.0..28.0)
}
))
}
#[test]
fn old_tank_ruptures() {
let engine = Atmosim::new(GameConfig::wizden_pmr());
let mix = engine.create_mixture(
gases! {
Gas::Frezon => 1.3,
Gas::Oxygen => 0.15,
Gas::Tritium => 0.15,
_ => 0.,
},
373.149,
);
let mut tank = GasContainer::new(mix);
tank.step_all();
eprintln!("{:?}", tank.state());
assert!(matches!(tank.state(), GasContainerState::Ruptured))
}
#[test]
fn goob_tank_explodes() {
let engine = Atmosim::new(GameConfig::goob());
let mix = engine.create_mixture(
gases! {
Gas::Oxygen => 1.550654,
Gas::Plasma => 0.889429,
Gas::Tritium => 0.664566,
_ => 0.,
},
381.07294,
);
let mut tank = GasContainer::new(mix);
tank.step_all();
eprintln!("{:?}", tank.state());
assert!(matches!(
tank.state(),
GasContainerState::Exploded {
radius: (20.0..21.0)
}
))
}
#[test]
fn goob_tank_idles() {
let engine = Atmosim::new(GameConfig::goob());
let mix = engine.create_mixture(
gases! {
Gas::Oxygen => 1.,
Gas::Tritium => 0.5,
_ => 0.,
},
373.149,
);
let mut tank = GasContainer::new(mix);
tank.step_all();
eprintln!("{:?}", tank.state());
assert!(matches!(tank.state(), GasContainerState::Idle))
}
#[test]
fn monolith_tank_explodes() {
let engine = Atmosim::new(GameConfig::monolith());
let mix = engine.create_mixture(
gases! {
Gas::Oxygen => 2.834242,
Gas::Plasma => 0.527630,
Gas::Tritium => 0.895024,
_ => 0.,
},
377.9979,
);
let mut tank = GasContainer::new(mix);
tank.step_all();
eprintln!("{:?}", tank.state());
assert!(matches!(
tank.state(),
GasContainerState::Exploded {
radius: (25.0..26.0)
}
))
}
#[test]
fn monolith_tank_idles() {
let engine = Atmosim::new(GameConfig::monolith());
let mix = engine.create_mixture(
gases! {
Gas::Oxygen => 2.,
Gas::Plasma => 0.6,
Gas::Tritium => 1.,
_ => 0.,
},
373.149,
);
let mut tank = GasContainer::new(mix);
tank.step_all();
eprintln!("{:?}", tank.state());
assert!(matches!(tank.state(), GasContainerState::Idle))
}