recharge test

This commit is contained in:
ntr 2019-03-21 00:12:41 +11:00
parent a4ccb087b1
commit a6fb81da0c
2 changed files with 28 additions and 0 deletions

View File

@ -129,6 +129,7 @@ impl CrypStat {
pub fn force(&mut self, v: u64) -> &mut CrypStat {
self.base = v;
self.value = v;
self.max = v;
self
}

View File

@ -973,6 +973,33 @@ mod tests {
assert!(y.hp() > prev_hp);
}
#[test]
fn recharge_test() {
let mut x = Cryp::new()
.named(&"muji".to_string());
let mut y = Cryp::new()
.named(&"pretaliation".to_string());
y.red_shield.force(50);
y.blue_shield.force(50);
y.deal_red_damage(Skill::Attack, 5);
y.deal_blue_damage(Skill::Blast, 5);
let mut res = Resolution::new(Skill::Recharge);
res = recharge(&mut x, &mut y, res);
match res.results[0] {
ResolutionResult::Recharge { red, blue, immunity: _ } => {
assert!(red == 5);
assert!(blue == 5);
}
_ => panic!("result was not recharge"),
}
}
#[test]
fn silence_test() {
let mut x = Cryp::new()